@castlabs/prestoplay 6.17.0 → 6.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +111 -111
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +566 -555
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +75 -74
  10. package/cjs/cl.externs.js +46 -46
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +71 -69
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +312 -312
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.sessions.js +15 -15
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +69 -69
  26. package/cjs/cl.ttml.js +28 -28
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +13 -13
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.youbora.js +18 -18
  32. package/cl.adobe.js +3 -3
  33. package/cl.airplay.js +3 -3
  34. package/cl.broadpeak.js +5 -5
  35. package/cl.cast.js +87 -87
  36. package/cl.conviva.js +27 -27
  37. package/cl.core.js +449 -442
  38. package/cl.crypto.js +8 -8
  39. package/cl.dash.js +70 -69
  40. package/cl.externs.js +46 -46
  41. package/cl.freewheel.js +19 -19
  42. package/cl.hls.js +72 -72
  43. package/cl.hlssmpte.js +5 -5
  44. package/cl.htmlcue.js +26 -26
  45. package/cl.ima.js +17 -17
  46. package/cl.mse.js +274 -274
  47. package/cl.muxdata.js +13 -13
  48. package/cl.onboard.js +4 -4
  49. package/cl.persistent.js +10 -10
  50. package/cl.playlist.js +5 -5
  51. package/cl.sessions.js +10 -10
  52. package/cl.simid.js +13 -13
  53. package/cl.smooth.js +59 -59
  54. package/cl.thumbnails.js +19 -19
  55. package/cl.tizen.js +57 -57
  56. package/cl.ttml.js +22 -22
  57. package/cl.verimatrix.js +4 -4
  58. package/cl.vimond.js +8 -8
  59. package/cl.vr.js +15 -15
  60. package/cl.vtt.js +12 -12
  61. package/cl.youbora.js +14 -14
  62. package/package.json +2 -2
  63. package/typings.d.ts +40 -5
package/cjs/cl.smooth.js CHANGED
@@ -1,76 +1,76 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var kP="Full MP4 box must have flags defined",lP="clpp.smooth.SmoothMP4Processor",mP="codecPrivateData",nP=function(a,b){var c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32);_.W(a,c);_.W(a,d)},oP=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Dm()}},pP=function(a,b){oP(a,b>>16&255);oP(a,b>>8&255);oP(a,b&255)},qP=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.Dm()}},rP=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.Dm()}},sP=function(a,b){try{a.f.setInt16(a.a,
3
- b,a.h),a.a+=2}catch(c){_.Dm()}},tP=function(a,b){if(void 0!==b){for(var c=new Uint8Array(b),d=Math.min(a.length,b),e=0;e<d;++e)c[e]=a.charCodeAt(e);for(;e<b;e++)c[e]=0;return c}c=new Uint8Array(a.length);for(d=0;d<a.length;++d)c[d]=a.charCodeAt(d);return c},uP=function(a){this.type=a;this.size=this.start=0;this.parent=null;this.A=!1;this.entries=[];this.f=[]},Z=function(a,b,c){uP.call(this,a);this.version=b;this.flags=c},vP=function(a,b,c){uP.call(this,a);this.h=b;this.offset=c},wP=function(a,b,c,
4
- d,e){Z.call(this,a,b,c);this.h=d;this.offset=e},xP=function(a,b,c){uP.call(this,"ftyp");this.j=a;this.Mh=b;this.h=c},yP=function(){uP.call(this,_.Ue)},zP=function(){uP.call(this,_.tg)},AP=function(a,b,c){Z.call(this,"mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.j=c+1;this.h=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]},BP=function(){uP.call(this,"mvex")},CP=function(a){Z.call(this,"trex",0,0);this.h=a},DP=function(a,b,c,d,e){Z.call(this,"tkhd",1,7);
5
- this.j=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.h=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]},EP=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},FP=function(a){Z.call(this,"hdlr",0,0);this.h=a},GP=function(){Z.call(this,"vmhd",0,1);this.h=new Uint8Array([0,0,0,0,0,0])},HP=function(a){uP.call(this,a);this.A=!0},IP=function(a){HP.call(this,a);this.height=this.width=0;this.depth=24},JP=
6
- function(a,b,c,d){HP.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},KP=function(a,b){IP.call(this,"avc1");this.width=a;this.height=b},LP=function(a,b){KP.call(this,a,b);this.type="encv"},MP=function(a,b,c){JP.call(this,"mp4a",a,b,c)},NP=function(a,b,c){MP.call(this,a,b,c);this.type="enca"},OP=function(a,b){uP.call(this,"avcC");this.Ua=a;this.ac=b;this.version=1;this.h=this.Ua[0][1];this.j=this.Ua[0][2];this.level=this.Ua[0][3]},PP=function(a){Z.call(this,"esds",0,0);this.Qb=
7
- a},QP=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},RP=function(){Z.call(this,"dref",0,0)},SP=function(){uP.call(this,_.jg)},TP=function(){Z.call(this,_.lg,0,0)},UP=function(){Z.call(this,"stts",0,0)},VP=function(){Z.call(this,"stsc",0,0)},WP=function(){Z.call(this,"stco",0,0)},XP=function(){Z.call(this,"stsz",0,0)},YP=function(){Z.call(this,"smhd",0,0)},ZP=function(){uP.call(this,"dinf")},$P=function(){uP.call(this,_.Te)},aQ=function(){uP.call(this,_.Pe)},bQ=function(a,b){Z.call(this,
8
- "tfdt",a,0);this.baseMediaDecodeTime=b},cQ=function(){Z.call(this,"mfhd",0,0);this.h=0},dQ=function(a,b){Z.call(this,"trun",a,b);this.o=this.l=this.h=0;this.w=[];this.sampleSize=[];this.B=[];this.j=[]},eQ=function(a,b){Z.call(this,"tfhd",a,b);this.h=255;this.o=this.w=this.l=this.B=this.j=0},fQ=function(){uP.call(this,"traf")},gQ=function(){uP.call(this,"moof")},hQ=function(){uP.call(this,_.Oe);this.h=new Uint8Array(0)},iQ=function(){Z.call(this,"tenc",0,0);this.h=1;this.j=8;this.o="";this.l=[]},jQ=
9
- function(a,b){Z.call(this,"schm",0,0);this.h=a;this.j=b;this.Kb=""},kQ=function(a){uP.call(this,"frma");this.h=a},lQ=function(){Z.call(this,"saio",0,0);this.offset=[0]},mQ=function(a,b,c){Z.call(this,"saiz",0,0);this.h=a;this.l=b;this.j=c},nQ=function(a,b){Z.call(this,"senc",a,b);this.j=0;this.l=8;this.h=[]},oQ=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},pQ=function(a,b,c,d){c=b.kh[c];b=b.xn;a=a.replace("Manifest","");b=b.replace("{bitrate}",
10
- String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.BC([a],[b])[0]},qQ=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.r?c=["maxWidth","maxHeight","bitrate",mP,"fourCC"]:a.type===_.bd&&(c=["bitrate",mP,"channels","bitsPerSample","samplingRate","fourCC"]);return _.O.la(a,b,c,["id","segmentIndex"])},rQ=function(a,b,c){var d=c.se.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Ua:null,
11
- ac:null,width:NaN,height:NaN,Qb:null,Yd:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.r:a.Ua=[_.yj(d[1])];a.ac=[_.yj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.bd:a.Qb=_.yj(c.se),a.sampleSize=c.Vi||16,a.Yd=c.Yd,a.channelCount=c.Cg}return a},sQ=function(a,b){return a.filter(function(c){return c.type===b})},tQ=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)},AQ=function(a,b,
12
- c){var d=null;if(uQ.test(a)){a=uQ.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 vQ.test(a)?d=tQ(vQ,a):wQ.test(a)?d=tQ(wQ,a):xQ.test(a)?(a=xQ.exec(a),d=Number(a[1])/c.frameRate):yQ.test(a)?(a=yQ.exec(a),d=Number(a[1])/c.a):zQ.test(a)&&(d=tQ(zQ,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
- d);return b+":"+c+":"+a+"."+d},BQ=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))},DQ=function(a){this.a=a;this.f=CQ(this)},CQ=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Cm(b)},EQ=function(a,b,c){a:{var d=_.w([_.Ud,_.Sd]);for(var e=d.next();!e.done;e=d.next())if((e=c.we(e.value))&&e.keyId){d=e.keyId;break a}_.Fh(lP,
14
- "Could not get default Key ID for DRM init data!");d=null}c=new uP("xxxx");a.type===_.r?c=new LP(a.width,a.height):c=new NP(a.channelCount,a.sampleSize,a.Yd);a=new iQ;a.h=1;a.j=8;a.o=d||"00000000000000000000000000000000";a=(new uP("schi")).append([a]);b=(new uP(_.dg)).append([new kQ(b),new jQ(_.ud,65536),a]);c.append([b]);return c},FQ=function(a,b){var c=b.ze(),d=new AP(a.timescale,a.duration,a.id),e=(new BP).append([new CP(a.id)]),f=new DP(a.id,a.duration,a.timescale,a.width,a.height),g=new EP(a.timescale,
15
- a.duration),h=new FP(a.type),l=null,m=new RP;m.entries=[new QP];var n=new TP;switch(a.type){case _.r:var p=new OP(a.Ua,a.ac);c?(l=EQ(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new KP(a.width,a.height)).append([p]),n.entries=[l]);l=new GP;break;case _.bd:p=new PP(a.Qb),c?(l=EQ(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new MP(a.channelCount,a.sampleSize,a.Yd)).append([p]),n.entries=[l]),l=new YP}n=(new SP).append([n,new UP,new VP,new XP,new WP]);m=(new ZP).append([m]);m=(new $P).append([l,m,n]);
16
- g=(new aQ).append([g,h,m]);f=(new zP).append([f,g]);d=(new yP).append([d,f,e]);e=new xP("dash",0,["iso6","mp41","avc1"]);c&&(c=b.we(_.Sd),f=b.we(_.Ud),c&&d.append([new vP("pssh",c.initData,8)]),f&&d.append([new vP("pssh",f.initData,8)]),c||f||_.Fh(lP,"Could not get PSSH init data!"));c=new DQ([e,d]);return _.lj(c.write())},HQ=function(a,b){var c,d,e,f,g,h;(new _.Pm).M("moof",_.Qm).Y("mfhd",function(m){var n=new cQ;n.h=_.Km(m.reader);c=n}).M("traf",_.Qm).Y("tfhd",function(m){var n=m.reader.Ha();if(null===
17
- m.flags)throw new _.P(_.Q,3,3019,kP);var p=new eQ(m.version||0,m.flags||0);p.h=_.Km(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.Mm(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.B=_.Km(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.l=_.Km(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.w=_.Km(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.o=_.Km(m.reader));d=p}).Y("trun",function(m){var n=m.reader.Ha();if(null===m.flags)throw new _.P(_.Q,3,3019,kP);var p=new dQ(m.version||
18
- 0,m.flags||0);p.h=_.Km(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.l=_.Lm(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.o=_.Km(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.h;n++)m.flags&256&&p.w.push(_.Km(m.reader)),m.flags&512&&p.sampleSize.push(_.Km(m.reader)),m.flags&1024&&p.B.push(_.Km(m.reader)),m.flags&2048&&(0===m.version?p.j.push(_.Km(m.reader)):p.j.push(_.Lm(m.reader)));e=p}).Y("sdtp",function(m){var n=_.Om(m.reader,m.reader.Ha());f=new wP("sdtp",m.version||0,m.flags||
19
- 0,n,0)}).M("uuid",function(m){var n=_.Om(m.reader,16);if(_.Aj(n,GQ)){n=_.Km(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new nQ(m.version,m.flags);n.j=_.Km(m.reader);m.flags&1&&(n.l=_.Im(m.reader));for(var p=0;p<n.j;p++){var q={zh:_.Om(m.reader,8),hd:0,ig:[]};if(m.flags&2){q.hd=_.Jm(m.reader);for(var u=0;u<q.hd;u++){var v={Ag:0,Bg:0};v.Ag=_.Jm(m.reader);v.Bg=_.Km(m.reader);q.ig.push(v)}}n.h.push(q)}g=n}}).M(_.Oe,function(m){var n=new hQ;0<m.reader.Ha()?n.h=_.Om(m.reader,m.reader.Ha()):(_.Fh(lP,
20
- "mdat box is empty!"),n.h=new Uint8Array(0));h=n}).parse(a,!1);if(!h)return null;var l=(new fQ).append([d,e]);f&&l.append([f]);b.ze()&&g&&l.append([g]);l=(new gQ).append([c,l]);return new DQ([l,h])},IQ=function(a,b,c,d){var e=d.ze(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=HQ(b,d);if(null===g)return a.request.contentType===_.R?a.data:g;d=g.get(_.Oe);if(a.request.contentType===_.R){e=d.h.buffer;if(c){e=_.S.Bd(e);if((e=(new DOMParser).parseFromString(e,_.rg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
21
- e.documentElement;if(h&&(d=new BQ(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",_.qe],m=0,n=l.length;m<n;m++){b:{var p=f;var q=l[m],u=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 C=q[v].name;if(C=C.match(u)){p=
22
- p.getAttribute(C[0]);break b}}p=null}}f.setAttribute(l[m],AQ(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.S.Va(e).buffer}else c=e;return c}h=new gQ;a=g.get("mfhd");b=new fQ;l=g.get("tfhd");m=new bQ(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");l.h=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.j;m++)l.push(10+6*c.h[m].hd);else g=8;b.append([c,new lQ,new mQ(g,l,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=
23
- new DQ([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},JQ=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},KQ=function(a,b,c){a=_.Sn(a);c&&a.version!==c&&(a=_.rC(a,c));return{initData:_.pC(a),initDataType:_.ud,keyId:b,periodId:null}},MQ=function(){this.w=this.h=this.f=
24
- this.C=null;this.N=1;this.S=0;this.l="";this.B=this.a=null;this.g=new _.K("clpp.smooth.SmoothParser");this.J=!1;this.j=this.A=null;this.L=LQ;this.H=0;this.D=this.I=Infinity;this.o=[];this.K=this.Xm.bind(this);this.G=new Map},NQ=function(a,b){var c,d,e;return _.H(function(f){if(1==f.a)return c=_.Jj(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
- c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.C.networkingEngine.fetch(c),_.y(f,d.P,2);e=f.f;a.l=e.uri;return f["return"](e)})},UQ=function(a,b){var c=null;try{var d=new DOMParser;try{var e=_.S.Bd(b);var f=d.parseFromString(e.trim(),_.rg)}catch(pI){throw pI;}if(f&&f.documentElement.tagName===_.dc)var g=f.documentElement;c=g&&0<g.getElementsByTagName("parsererror").length?null:g}catch(pI){}if(!c)throw a.g.error("Unable to parse manifest"),new _.P(_.Q,4,4033,a.l);var h=+OQ(a,c,"MajorVersion"),
26
- l=+OQ(a,c,"MinorVersion"),m=+c.getAttribute("TimeScale")||1E7,n=+OQ(a,c,"Duration"),p="TRUE"===c.getAttribute("IsLive"),q=+c.getAttribute("LookAheadCount"),u=+c.getAttribute("DVRWindowLength")||Infinity,v=_.En(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+h+"."+l))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.P(_.Q,4,4036,a.l);p?(PQ(a,QQ),a.A=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),n=Infinity):PQ(a,LQ);a.a={startTime:0,delay:0,
27
- duration:n/m,uf:u/m,Rd:0};if(v){var z=a.f.playreadyVersion,C=[],I=_.En(v,"ProtectionHeader")[0],F=_.xj(_.Gn(I)||""),D=_.Sn(F).a;C.push(JQ(_.Ud,{initData:_.pC(_.Ln(D)),initDataType:_.ud,keyId:D,periodId:null},[D]));C.push(JQ(_.Sd,KQ(F,D,z),[D]));a.o=C}var G=[],M=_.En(c,"StreamIndex");if(!M.length)throw a.g.error("No streams found!"),new _.P(_.Q,4,4034,a.l);for(var N=0;N<M.length;N++){for(var U,oa=a,Ca=M[N],ab=OQ(oa,Ca,"Type"),bb=+Ca.getAttribute("Chunks"),Qa=Ca.getAttribute("Subtype"),Da=Ca.getAttribute("Language")||
28
- _.vg,fb=_.dj(Da),pc=Ca.getAttribute("Name")||"",Ag=+Ca.getAttribute(_.zb),Bg=+Ca.getAttribute(_.yb),nn=OQ(oa,Ca,"Url"),Yt=+Ca.getAttribute("TimeScale")||null,fd=[],on=_.En(Ca,_.Sb),Hu=0;Hu<on.length;Hu++){var Bf=void 0,rc=void 0,Iu=void 0,Cf=oa,Gd=on[Hu],Ju=ab,DU=+Gd.getAttribute("Index"),EU=+OQ(Cf,Gd,"Bitrate"),sI=NaN,tI=NaN,ko=NaN,Ku=NaN,uI=NaN,vI=NaN,wI=NaN,xI=Gd.getAttribute("FourCC");switch(Ju){case _.r:sI=+OQ(Cf,Gd,_.yb);tI=+OQ(Cf,Gd,_.zb);break;case _.bd:Ku=+Gd.getAttribute("Channels")||2,
29
- ko=+OQ(Cf,Gd,"SamplingRate"),vI=+OQ(Cf,Gd,"AudioTag"),uI=+OQ(Cf,Gd,"BitsPerSample"),wI=+OQ(Cf,Gd,"PacketSize")}var Lu=String(Gd.getAttribute("CodecPrivateData"));if(Ju===_.bd&&!Lu){var yI=Ku,zI={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},lo=zI[ko];if("AACH"===xI){rc=new Uint8Array(4);var AI=zI[2*ko];rc[0]=40|lo>>1;rc[1]=lo<<7|yI<<3|AI>>1;rc[2]=AI<<7|8;rc[3]=0;Bf=new Uint16Array(2);Bf[0]=(rc[0]<<8)+rc[1];Bf[1]=(rc[2]<<8)+rc[3];Iu=Bf[0].toString(16)+
30
- Bf[1].toString(16)}else rc=new Uint8Array(2),rc[0]=16|lo>>1,rc[1]=lo<<7|yI<<3,Bf=new Uint16Array(1),Bf[0]=(rc[0]<<8)+rc[1],Iu=Bf[0].toString(16);Lu=Iu.toUpperCase()}var FU={id:Cf.S++,type:Ju,index:DU,bitrate:EU,se:Lu,maxHeight:sI,maxWidth:tI,Yd:ko,Cg:Ku,Nn:vI,Vi:uI,co:wI,Ik:xI,segmentIndex:null};fd.push(FU)}U=fd;for(var Me=[],BI=_.En(Ca,"c"),lk=0;lk<BI.length;lk++){var Mu=BI[lk],fe=parseInt(Mu.getAttribute("t"),10),Yh=parseInt(Mu.getAttribute("d"),10),Nu=parseInt(Mu.getAttribute("r"),10),mk=0;if(isNaN(fe)&&
31
- isNaN(Yh))throw oa.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.P(_.Q,4,4037,oa.l);0===lk&&isNaN(fe)&&(mk=fe=0);if(0<lk){var Eg=Me[Me.length-1];mk=Eg.n+1;Eg.d||(Eg.d=fe-Eg.t);fe||(fe=Eg.t+Eg.d);Yh||(Yh=fe-Eg.t)}Me.push({n:mk,d:Yh,t:fe});if(Nu){Nu--;for(var CI=0;CI<Nu;CI++){var mo=Me[Me.length-1];mk=mo.n+1;fe=mo.t+mo.d;Yh=mo.d;Me.push({n:mk,d:Yh,t:fe})}}}oa.sd()||Me.length===bb||oa.g.warn("Number of fragments ("+bb+") differs from number of chunks ("+
32
- Me.length+").");G.push({type:ab,Rn:bb,hn:Qa,language:fb,Qd:Da,name:pc,maxWidth:Ag,maxHeight:Bg,xn:nn,tracks:U,kh:Me,timescale:Yt})}var Df={ao:h,Mh:l,timescale:m,duration:n,isLive:p,$n:q,uf:u,Ff:!1,streams:G};if(a.h&&a.w)return RQ(a,Df),Promise.resolve();a.G.clear();var Ou=Df.timescale,no=Df.duration,HU=sQ(Df.streams,_.bd),IU=sQ(Df.streams,_.r),JU=sQ(Df.streams,_.R),DI=[],oo=SQ(a,no,Ou,HU),po=SQ(a,no,Ou,IU),KU=SQ(a,no,Ou,JU);oo.length||(oo=[null]);po.length||(po=[null]);for(var Qu=0;Qu<po.length;Qu++)for(var Ru=
33
- 0;Ru<oo.length;Ru++)DI.push(TQ(a,po[Qu],oo[Ru]));var EI={id:"ID",configurationId:void 0,startTime:0,endTime:no,variants:DI,textStreams:KU,thumbStreams:[]};var MU=Df.streams,Su=a.a.startTime,FI=a.a.delay,Tu=a.I,GI=Math.min(a.a.duration||Infinity,Tu),Uu=a.sd(),NU=a.a.uf,OU=a.a.Rd,HI=a.H,II=isFinite(a.D)?a.D:0;if(Uu)GI=Infinity,Su=Date.now()/1E3-OU,a.a.startTime=Su,FI=3*HI;else for(var PU=isFinite(Tu)?Tu:a.a.duration,JI=_.w(MU),Vu=JI.next();!Vu.done;Vu=JI.next())for(var KI=_.w(Vu.value.tracks),Wu=KI.next();!Wu.done;Wu=
34
- KI.next()){var LI=Wu.value;LI.segmentIndex.offset(-II);_.ZC(LI.segmentIndex,PU)}a.B=new _.gD(a.f.timeline||{},Su,FI,!Uu,!0);a.B.f=GI;_.oD(a.B,HI);a.B.A=NU;Uu||a.B.offset(-II);a.C.filterAllPeriods([EI]);a.h={presentationTimeline:a.B,periods:[EI],minBufferTime:0};Promise.resolve();a.J||(a.C.networkingEngine.Nc(a.K),a.J=!0);a.w=Df;return Promise.resolve()},RQ=function(a,b){for(var c=0;c<a.w.streams.length;c++)for(var d=b.streams[c],e={},f=_.w(a.w.streams[c].tracks),g=f.next();!g.done;e={Ob:e.Ob},g=f.next())if(e.Ob=
35
- g.value,g=d.tracks.find(function(l){return function(m){return m.type===l.Ob.type&&m.bitrate===l.Ob.bitrate}}(e))){qQ(e.Ob,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=VQ(a,a.w.timescale,d,g);g=e.Ob.segmentIndex;g.oa(h);(h=a.a.uf)&&_.FD(g,_.ED(g)-h).forEach(function(l){l.Ra().forEach(function(m){a.G["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.Ob.type+" track with bitrate "+(e.Ob.bitrate+". Skipping update."))},
36
- SQ=function(a,b,c,d){for(var e=[],f={Hc:0};f.Hc<d.length;f={Hc:f.Hc},f.Hc++){var g=d[f.Hc].tracks.map(function(h){return function(l){var m=d[h.Hc],n=VQ(a,c,m,l);n=new _.DD(n);var p=null;m.type!==_.R&&(p=WQ(a,b,c,m,l));l.segmentIndex=n;var q=_.iJ++,u=Promise.resolve.bind(Promise),v=n.find.bind(n),z=n.get.bind(n),C=n.nd.bind(n),I=n.getDuration.bind(n),F=XQ[m.type],D="";switch(m.type){case _.r:D=l.se;var G=/00000001[0-9]7/.exec(D);D="avc1."+(G&&G[0]?D.substr(D.indexOf(G[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",
37
- D);break;case _.bd:D=l.se,G=2,"AACH"===l.Ik?G=5:D&&(G=(parseInt(D.substr(0,2),16)&248)>>3),D="mp4a.40."+G,a.g.debug("AUDIO CODECS: ",D)}G=m.type===_.R?YQ[m.hn]:void 0;return{id:q,originalId:null,fo:null,createSegmentIndex:u,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:C,getDuration:I,segmentIndex:n,segmentLookupStrategy:_.ZB,initSegmentReference:p,mimeType:F,codecs:D,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:G,encrypted:a.Gf(),
38
- keyId:null,language:m.language,originalLanguage:m.Qd,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.Cg||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},VQ=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.kh.forEach(function(h,l){var m=h.d/g;if(0===l){var n=h.t/g;a.D=Math.min(a.D,n)}else n=f[l-1].endTime;var p=n+m,q=pQ(a.l,c,l,d);a.H=Math.max(a.H,m);f.push(new _.bj(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.G.set(q,
39
- n);e+=m});if(c.type===_.r||c.type===_.bd)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Rd?a.a.Rd=b.endTime:a.a.Rd=Math.min(a.a.Rd,b.endTime);return f},WQ=function(a,b,c,d,e){b=rQ(b,d.timescale||c,e);c={isLive:a.sd.bind(a),ze:a.Gf.bind(a),Qk:function(){return 1},we:a.nh.bind(a)};d=new Uint8Array(0);try{d=FQ(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.P(_.Q,3,4035,g);}var f="data:text/plain;base64,"+_.wj(d);return new _.DC(function(){return[f]},0,null,null,!0)},TQ=
40
- function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.vg;return c||b?{id:a.N++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},OQ=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.P(_.Q,4,4038,a.l,c);},ZQ=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Ib.bind(a),b))},PQ=function(a,b){var c=b===LQ;a.h&&a.h.presentationTimeline&&_.jD(a.h.presentationTimeline,
41
- c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.L=b},$Q=function(){};uP.prototype.append=function(a){a=void 0===a?[]:a;for(var b=0;b<a.length;b++)this.f.push(a[b]),a[b].parent=this;return this};uP.prototype.get=function(a){if(this.type===a)return this;for(var b=0;b<this.f.length;b++){if(this.f[b].type===a)return this.f[b];var c=this.f[b].get(a);if(c)return c}return null};
42
- uP.prototype.a=function(){var a=Math.pow(2,32)-1;var b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.f.length)for(var c=0;c<this.f.length;c++)b+=this.f[c].a();this.size>a&&(b+=8);return b};
43
- uP.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);_.Em(a,tP(this.type));this.size>b&&nP(a,this.size);"uuid"===this.type&&_.Em(a,null);if(0<this.f.length&&!this.A)for(b=0;b<this.f.length;b++)this.f[b].write(a),this.f[b].a(),a.getPosition()};_.x(Z,uP);Z.prototype.a=function(){return 4+uP.prototype.a.call(this)};Z.prototype.write=function(a){uP.prototype.write.call(this,a);oP(a,this.version);pP(a,this.flags)};
44
- _.x(vP,uP);vP.prototype.a=function(){return this.h.byteLength+uP.prototype.a.call(this)-this.offset};vP.prototype.write=function(a){uP.prototype.write.call(this,a);_.Em(a,this.h,this.offset);a.getPosition()};_.x(wP,Z);wP.prototype.a=function(){return this.h.byteLength+Z.prototype.a.call(this)-this.offset};wP.prototype.write=function(a){Z.prototype.write.call(this,a);_.Em(a,this.h,this.offset);a.getPosition()};_.x(xP,uP);
45
- xP.prototype.a=function(){var a=this.j.length;a=a+4+this.h.join("").length;return a+uP.prototype.a.call(this)};xP.prototype.write=function(a){uP.prototype.write.call(this,a);_.Em(a,tP(this.j));_.W(a,this.Mh);_.Em(a,tP(this.h.join("")));a.getPosition()};_.x(yP,uP);_.x(zP,uP);_.x(AP,Z);AP.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;a=a+44+this.h.length;return a+=Z.prototype.a.call(this)};
46
- AP.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(nP(a,0),nP(a,0),_.W(a,this.timescale),nP(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));_.W(a,65536);qP(a,this.volume);qP(a,0);_.W(a,0);_.W(a,0);for(var b=0;b<this.h.length;b++)oP(a,this.h[b]);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,this.j);a.getPosition()};_.x(BP,uP);_.x(CP,Z);CP.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
- CP.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);_.W(a,1);_.W(a,0);_.W(a,0);_.W(a,0);a.getPosition()};_.x(DP,Z);DP.prototype.a=function(){var a=0;a=1===this.version?a+32:a+20;a=a+24+this.h.length;return a+Z.prototype.a.call(this)};
48
- DP.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(nP(a,0),nP(a,0),_.W(a,this.j),_.W(a,0),nP(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.j),_.W(a,0),_.W(a,this.duration*this.timescale));_.W(a,0);_.W(a,0);qP(a,0);qP(a,0);qP(a,this.volume);qP(a,0);for(var b=0;b<this.h.length;b++)oP(a,this.h[b]);qP(a,this.width);qP(a,0);qP(a,this.height);qP(a,0);a.getPosition()};_.x(EP,Z);EP.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
49
- EP.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(nP(a,0),nP(a,0),_.W(a,this.timescale),nP(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));qP(a,this.language);qP(a,0);a.getPosition()};_.x(FP,Z);FP.prototype.a=function(){return 33+Z.prototype.a.call(this)};
50
- FP.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);this.h===_.r?_.Em(a,tP("vide")):_.Em(a,tP("soun"));_.W(a,0);_.W(a,0);_.W(a,0);this.h===_.r?_.Em(a,tP("VideoHandler\x00")):_.Em(a,tP("SoundHandler\x00"));a.getPosition()};_.x(GP,Z);GP.prototype.a=function(){return 2+this.h.byteLength+Z.prototype.a.call(this)};GP.prototype.write=function(a){Z.prototype.write.call(this,a);qP(a,0);_.Em(a,this.h);a.getPosition()};_.x(HP,uP);HP.prototype.a=function(){return 8+uP.prototype.a.call(this)};
51
- HP.prototype.write=function(a){uP.prototype.write.call(this,a);_.W(a,0);qP(a,0);qP(a,1)};_.x(IP,HP);IP.prototype.a=function(){return 70+HP.prototype.a.call(this)};IP.prototype.write=function(a){HP.prototype.write.call(this,a);qP(a,0);qP(a,0);_.W(a,0);_.W(a,0);_.W(a,0);qP(a,this.width);qP(a,this.height);_.W(a,4718592);_.W(a,4718592);_.W(a,0);qP(a,1);oP(a,10);_.Em(a,tP("AVC Coding",31));qP(a,this.depth);sP(a,-1)};_.x(JP,HP);JP.prototype.a=function(){return 20+HP.prototype.a.call(this)};
52
- JP.prototype.write=function(a){HP.prototype.write.call(this,a);_.W(a,0);_.W(a,0);qP(a,this.channelCount);qP(a,this.sampleSize);sP(a,0);qP(a,0);qP(a,this.sampleRate);qP(a,0)};_.x(KP,IP);KP.prototype.write=function(a){IP.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.x(LP,KP);_.x(MP,JP);MP.prototype.write=function(a){JP.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.x(NP,MP);_.x(OP,uP);
53
- OP.prototype.a=function(){for(var a=7,b=0;b<this.Ua.length;b++)a+=2,a+=this.Ua[b].byteLength;for(b=0;b<this.Ua.length;b++)a+=2,a+=this.ac[b].byteLength;return a+uP.prototype.a.call(this)};
54
- OP.prototype.write=function(a){uP.prototype.write.call(this,a);oP(a,this.version);oP(a,this.h);oP(a,this.j);oP(a,this.level);oP(a,255);oP(a,224|this.Ua.length);for(var b=0;b<this.Ua.length;b++)qP(a,this.Ua[b].length),_.Em(a,this.Ua[b]);oP(a,this.ac.length);for(b=0;b<this.ac.length;b++)qP(a,this.ac[b].length),_.Em(a,this.ac[b]);a.getPosition()};_.x(PP,Z);PP.prototype.a=function(){return 22+(this.Qb.byteLength+3)+Z.prototype.a.call(this)};
55
- PP.prototype.write=function(a){Z.prototype.write.call(this,a);oP(a,3);oP(a,23+this.Qb.byteLength);qP(a,1);oP(a,0);oP(a,4);oP(a,15+this.Qb.byteLength);oP(a,64);oP(a,21);pP(a,0);_.W(a,0);_.W(a,0);oP(a,5);oP(a,this.Qb.byteLength);_.Em(a,this.Qb);_.Em(a,new Uint8Array([6,1,2]));a.getPosition()};_.x(QP,Z);QP.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};QP.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.Em(a,tP(this.location));a.getPosition()};
56
- _.x(RP,Z);RP.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};RP.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(SP,uP);_.x(TP,Z);TP.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};
57
- TP.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(UP,Z);UP.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};UP.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(VP,Z);
58
- VP.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};VP.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(WP,Z);WP.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};
59
- WP.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(XP,Z);XP.prototype.a=function(){return 8+Z.prototype.a.call(this)};XP.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);_.W(a,0);a.getPosition()};_.x(YP,Z);YP.prototype.a=function(){return 4+Z.prototype.a.call(this)};YP.prototype.write=function(a){Z.prototype.write.call(this,a);sP(a,0);qP(a,0);a.getPosition()};
60
- _.x(ZP,uP);_.x($P,uP);_.x(aQ,uP);_.x(bQ,Z);bQ.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};bQ.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?nP(a,this.baseMediaDecodeTime):_.W(a,this.baseMediaDecodeTime);a.getPosition()};_.x(cQ,Z);cQ.prototype.a=function(){return 4+Z.prototype.a.call(this)};cQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);a.getPosition()};_.x(dQ,Z);
61
- dQ.prototype.a=function(){var a=4;this.flags&aR&&(a+=4);this.flags&bR&&(a+=4);for(var b=0;b<this.h;b++)this.flags&cR&&(a+=4),this.flags&dR&&(a+=4),this.flags&eR&&(a+=4),this.flags&fR&&(a+=4);return a+Z.prototype.a.call(this)};
62
- dQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);this.flags&aR&&(a.getPosition(),rP(a,this.l));this.flags&bR&&_.W(a,this.o);for(var b=0;b<this.h;b++)this.flags&cR&&_.W(a,this.w[b]),this.flags&dR&&_.W(a,this.sampleSize[b]),this.flags&eR&&_.W(a,this.B[b]),this.flags&fR&&(0===this.version?_.W(a,this.j[b]):rP(a,this.j[b]));a.getPosition()};var aR=1,bR=4,cR=256,dR=512,eR=1024,fR=2048;_.x(eQ,Z);
63
- eQ.prototype.a=function(){var a=4;this.flags&gR&&(a+=8);this.flags&hR&&(a+=4);this.flags&iR&&(a+=4);this.flags&jR&&(a+=4);this.flags&kR&&(a+=4);return a+Z.prototype.a.call(this)};eQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);this.flags&gR&&nP(a,this.j);this.flags&hR&&_.W(a,this.B);this.flags&iR&&_.W(a,this.l);this.flags&jR&&_.W(a,this.w);this.flags&kR&&_.W(a,this.o);a.getPosition()};var gR=1,hR=2,iR=8,jR=16,kR=32;_.x(fQ,uP);_.x(gQ,uP);_.x(hQ,uP);
64
- hQ.prototype.a=function(){return this.h.byteLength+uP.prototype.a.call(this)};hQ.prototype.write=function(a){uP.prototype.write.call(this,a);0<this.h.byteLength&&_.Em(a,this.h)};_.x(iQ,Z);iQ.prototype.a=function(){var a=20;1===this.h&&0===this.j&&(a=a+1+this.l.length);return a+Z.prototype.a.call(this)};
65
- iQ.prototype.write=function(a){Z.prototype.write.call(this,a);oP(a,0);0===this.version?oP(a,0):oP(a,0);oP(a,this.h);oP(a,this.j);_.Em(a,_.yj(this.o));if(1===this.h&&0===this.j){oP(a,0);for(var b=0;b<this.l.length;b++)oP(a,this.l[b])}a.getPosition()};_.x(jQ,Z);jQ.prototype.a=function(){var a=8;this.flags&1&&(a+=tP(this.Kb).byteLength);return a+Z.prototype.a.call(this)};jQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.Em(a,tP(this.h));_.W(a,this.j);this.flags&1&&_.Em(a,tP(this.Kb));a.getPosition()};
66
- _.x(kQ,uP);kQ.prototype.a=function(){return tP(this.h).byteLength+uP.prototype.a.call(this)};kQ.prototype.write=function(a){uP.prototype.write.call(this,a);_.Em(a,tP(this.h));a.getPosition()};_.x(lQ,Z);lQ.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=4;for(var b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+Z.prototype.a.call(this)};
67
- lQ.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));_.W(a,1);for(var b=0;1>b;b++)0===this.version?_.W(a,this.offset[b]):nP(a,this.offset[b]);a.getPosition()};_.x(mQ,Z);mQ.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=5;0===this.h&&(a+=this.l.length);return a+Z.prototype.a.call(this)};
68
- mQ.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));oP(a,this.h);_.W(a,this.j);if(0===this.h)for(var b=0;b<this.j;b++)oP(a,this.l[b]);a.getPosition()};_.x(nQ,Z);nQ.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.j;b++)if(a+=this.h[b].zh.byteLength,this.flags&2){a+=2;for(var c=0;c<this.h[b].hd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
69
- nQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.j);this.flags&1&&oP(a,this.l);for(var b=0;b<this.j;b++)if(_.Em(a,this.h[b].zh),this.flags&2){qP(a,this.h[b].hd);for(var c=0;c<this.h[b].hd;c++)qP(a,this.h[b].ig[c].Ag),_.W(a,this.h[b].ig[c].Bg)}a.getPosition()};var uQ=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,vQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,wQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,xQ=/^(\d*\.?\d*)f$/,yQ=/^(\d*\.?\d*)t$/,zQ=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;DQ.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};DQ.prototype.write=function(){this.f=CQ(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var GQ=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.t=MQ.prototype;_.t.configure=function(a){this.f=a};_.t.start=function(a,b){var c=this;this.C=b;var d=_.ch(new Set([a,oQ(a)])).concat();return NQ(this,d).then(function(e){return UQ(c,e.data).then(function(){ZQ(c,c.A);return c.h})})};_.t.requestStop=function(){};_.t.stop=function(){this.C&&this.C.networkingEngine.Xd(this.K);this.A=this.w=this.h=this.f=this.C=null;this.j&&(clearTimeout(this.j),this.j=null);this.J=!1;this.I=this.D=Infinity;return Promise.resolve()};
70
- _.t.update=function(){var a=this;if(this.sd())return NQ(this,[this.l]).then(function(b){return UQ(a,b.data).then(function(){return a.h})})["catch"](function(b){if(a.C)a.C.onError(b)})};_.t.setCurrentVariant=function(){};_.t.Ib=function(){var a=this;this.g.debug(_.RB);this.C&&(this.j=null,this.update().then(function(){ZQ(a,a.A)})["catch"](function(b){a.C&&(a.C.onError(b),1===b.severity&&ZQ(a,100))}))};_.t.sd=function(){return this.L===QQ};_.t.Gf=function(){return 0<this.o.length};
71
- _.t.nh=function(a){var b=null;if(this.o.length)for(var c=0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b};
72
- _.t.Xm=function(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);var b=a.request.timescale||this.w.timescale,c={isLive:this.sd.bind(this),ze:this.Gf.bind(this),Qk:function(){return 1},we:this.nh.bind(this)},d=!1,e=new _.P(_.Q,3,4035,null),f=null;try{var g=this.G.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=IQ(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)};var XQ={video:_.Jg,audio:_.gd,text:_.Zc},LQ=_.nc,QQ="LIVE",YQ={zn:_.qd,Gn:_.ng};_.x($Q,_.Js);$Q.prototype.f=function(){_.It.ism=MQ;_.Gt[_.$c]=MQ};$Q.prototype.a=function(){_.gE("ism");_.hE(_.$c)};$Q.prototype.id=function(){return _.eg};_.J("clpp.smooth.SmoothComponent",$Q);};
2
+ var f=function(window){var tP="Full MP4 box must have flags defined",uP="clpp.smooth.SmoothMP4Processor",vP="codecPrivateData",wP=function(a,b){var c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32);_.V(a,c);_.V(a,d)},xP=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Gm()}},yP=function(a,b){xP(a,b>>16&255);xP(a,b>>8&255);xP(a,b&255)},zP=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.Gm()}},AP=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.Gm()}},BP=function(a,b){try{a.f.setInt16(a.a,
3
+ b,a.h),a.a+=2}catch(c){_.Gm()}},CP=function(a,b){if(void 0!==b){for(var c=new Uint8Array(b),d=Math.min(a.length,b),e=0;e<d;++e)c[e]=a.charCodeAt(e);for(;e<b;e++)c[e]=0;return c}c=new Uint8Array(a.length);for(d=0;d<a.length;++d)c[d]=a.charCodeAt(d);return c},DP=function(a){this.type=a;this.size=this.start=0;this.parent=null;this.A=!1;this.entries=[];this.f=[]},Z=function(a,b,c){DP.call(this,a);this.version=b;this.flags=c},EP=function(a,b,c){DP.call(this,a);this.h=b;this.offset=c},FP=function(a,b,c,
4
+ d,e){Z.call(this,a,b,c);this.h=d;this.offset=e},GP=function(a,b,c){DP.call(this,"ftyp");this.j=a;this.Ph=b;this.h=c},HP=function(){DP.call(this,_.We)},IP=function(){DP.call(this,_.vg)},JP=function(a,b,c){Z.call(this,"mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.j=c+1;this.h=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]},KP=function(){DP.call(this,"mvex")},LP=function(a){Z.call(this,"trex",0,0);this.h=a},MP=function(a,b,c,d,e){Z.call(this,"tkhd",1,7);
5
+ this.j=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.h=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]},NP=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},OP=function(a){Z.call(this,"hdlr",0,0);this.h=a},PP=function(){Z.call(this,"vmhd",0,1);this.h=new Uint8Array([0,0,0,0,0,0])},QP=function(a){DP.call(this,a);this.A=!0},RP=function(a){QP.call(this,a);this.height=this.width=0;this.depth=24},SP=
6
+ function(a,b,c,d){QP.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},TP=function(a,b){RP.call(this,"avc1");this.width=a;this.height=b},UP=function(a,b){TP.call(this,a,b);this.type="encv"},VP=function(a,b,c){SP.call(this,"mp4a",a,b,c)},WP=function(a,b,c){VP.call(this,a,b,c);this.type="enca"},XP=function(a,b){DP.call(this,"avcC");this.Va=a;this.bc=b;this.version=1;this.h=this.Va[0][1];this.j=this.Va[0][2];this.level=this.Va[0][3]},YP=function(a){Z.call(this,"esds",0,0);this.Ub=
7
+ a},ZP=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},$P=function(){Z.call(this,"dref",0,0)},aQ=function(){DP.call(this,_.lg)},bQ=function(){Z.call(this,_.ng,0,0)},cQ=function(){Z.call(this,"stts",0,0)},dQ=function(){Z.call(this,"stsc",0,0)},eQ=function(){Z.call(this,"stco",0,0)},fQ=function(){Z.call(this,"stsz",0,0)},gQ=function(){Z.call(this,"smhd",0,0)},hQ=function(){DP.call(this,"dinf")},iQ=function(){DP.call(this,_.Ve)},jQ=function(){DP.call(this,_.Re)},kQ=function(a,b){Z.call(this,
8
+ "tfdt",a,0);this.baseMediaDecodeTime=b},lQ=function(){Z.call(this,"mfhd",0,0);this.h=0},mQ=function(a,b){Z.call(this,"trun",a,b);this.o=this.l=this.h=0;this.w=[];this.sampleSize=[];this.B=[];this.j=[]},nQ=function(a,b){Z.call(this,"tfhd",a,b);this.h=255;this.o=this.w=this.l=this.B=this.j=0},oQ=function(){DP.call(this,"traf")},pQ=function(){DP.call(this,"moof")},qQ=function(){DP.call(this,_.Qe);this.h=new Uint8Array(0)},rQ=function(){Z.call(this,"tenc",0,0);this.h=1;this.j=8;this.o="";this.l=[]},sQ=
9
+ function(a,b){Z.call(this,"schm",0,0);this.h=a;this.j=b;this.Pb=""},tQ=function(a){DP.call(this,"frma");this.h=a},uQ=function(){Z.call(this,"saio",0,0);this.offset=[0]},vQ=function(a,b,c){Z.call(this,"saiz",0,0);this.h=a;this.l=b;this.j=c},wQ=function(a,b){Z.call(this,"senc",a,b);this.j=0;this.l=8;this.h=[]},xQ=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},yQ=function(a,b,c,d){c=b.nh[c];b=b.Cn;a=a.replace("Manifest","");b=b.replace("{bitrate}",
10
+ String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.KC([a],[b])[0]},zQ=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.r?c=["maxWidth","maxHeight","bitrate",vP,"fourCC"]:a.type===_.cd&&(c=["bitrate",vP,"channels","bitsPerSample","samplingRate","fourCC"]);return _.M.la(a,b,c,["id","segmentIndex"])},AQ=function(a,b,c){var d=c.se.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Va:null,
11
+ bc:null,width:NaN,height:NaN,Ub:null,Zd:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.r:a.Va=[_.Bj(d[1])];a.bc=[_.Bj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.cd:a.Ub=_.Bj(c.se),a.sampleSize=c.Xi||16,a.Zd=c.Zd,a.channelCount=c.Fg}return a},BQ=function(a,b){return a.filter(function(c){return c.type===b})},CQ=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)},JQ=function(a,b,
12
+ c){var d=null;if(DQ.test(a)){a=DQ.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 EQ.test(a)?d=CQ(EQ,a):FQ.test(a)?d=CQ(FQ,a):GQ.test(a)?(a=GQ.exec(a),d=Number(a[1])/c.frameRate):HQ.test(a)?(a=HQ.exec(a),d=Number(a[1])/c.a):IQ.test(a)&&(d=CQ(IQ,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
+ d);return b+":"+c+":"+a+"."+d},KQ=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))},MQ=function(a){this.a=a;this.f=LQ(this)},LQ=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Fm(b)},NQ=function(a,b,c){a:{var d=_.w([_.Vd,_.Td]);for(var e=d.next();!e.done;e=d.next())if((e=c.ye(e.value))&&e.keyId){d=e.keyId;break a}_.Ih(uP,
14
+ "Could not get default Key ID for DRM init data!");d=null}c=new DP("xxxx");a.type===_.r?c=new UP(a.width,a.height):c=new WP(a.channelCount,a.sampleSize,a.Zd);a=new rQ;a.h=1;a.j=8;a.o=d||"00000000000000000000000000000000";a=(new DP("schi")).append([a]);b=(new DP(_.fg)).append([new tQ(b),new sQ(_.vd,65536),a]);c.append([b]);return c},OQ=function(a,b){var c=b.Be(),d=new JP(a.timescale,a.duration,a.id),e=(new KP).append([new LP(a.id)]),f=new MP(a.id,a.duration,a.timescale,a.width,a.height),g=new NP(a.timescale,
15
+ a.duration),h=new OP(a.type),l=null,m=new $P;m.entries=[new ZP];var n=new bQ;switch(a.type){case _.r:var p=new XP(a.Va,a.bc);c?(l=NQ(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new TP(a.width,a.height)).append([p]),n.entries=[l]);l=new PP;break;case _.cd:p=new YP(a.Ub),c?(l=NQ(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new VP(a.channelCount,a.sampleSize,a.Zd)).append([p]),n.entries=[l]),l=new gQ}n=(new aQ).append([n,new cQ,new dQ,new fQ,new eQ]);m=(new hQ).append([m]);m=(new iQ).append([l,m,n]);
16
+ g=(new jQ).append([g,h,m]);f=(new IP).append([f,g]);d=(new HP).append([d,f,e]);e=new GP("dash",0,["iso6","mp41","avc1"]);c&&(c=b.ye(_.Td),f=b.ye(_.Vd),c&&d.append([new EP("pssh",c.initData,8)]),f&&d.append([new EP("pssh",f.initData,8)]),c||f||_.Ih(uP,"Could not get PSSH init data!"));c=new MQ([e,d]);return _.oj(c.write())},QQ=function(a,b){var c,d,e,f,g,h;(new _.Rm).M("moof",_.Sm).Y("mfhd",function(m){var n=new lQ;n.h=_.W(m.reader);c=n}).M("traf",_.Sm).Y("tfhd",function(m){var n=m.reader.Ia();if(null===
17
+ m.flags)throw new _.N(_.O,3,3019,tP);var p=new nQ(m.version||0,m.flags||0);p.h=_.W(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.Om(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.B=_.W(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.l=_.W(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.w=_.W(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.o=_.W(m.reader));d=p}).Y("trun",function(m){var n=m.reader.Ia();if(null===m.flags)throw new _.N(_.O,3,3019,tP);var p=new mQ(m.version||
18
+ 0,m.flags||0);p.h=_.W(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.l=_.Nm(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.o=_.W(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.h;n++)m.flags&256&&p.w.push(_.W(m.reader)),m.flags&512&&p.sampleSize.push(_.W(m.reader)),m.flags&1024&&p.B.push(_.W(m.reader)),m.flags&2048&&(0===m.version?p.j.push(_.W(m.reader)):p.j.push(_.Nm(m.reader)));e=p}).Y("sdtp",function(m){var n=_.Qm(m.reader,m.reader.Ia());f=new FP("sdtp",m.version||0,m.flags||0,
19
+ n,0)}).M("uuid",function(m){var n=_.Qm(m.reader,16);if(_.Dj(n,PQ)){n=_.W(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new wQ(m.version,m.flags);n.j=_.W(m.reader);m.flags&1&&(n.l=_.Lm(m.reader));for(var p=0;p<n.j;p++){var q={Ch:_.Qm(m.reader,8),hd:0,lg:[]};if(m.flags&2){q.hd=_.Mm(m.reader);for(var u=0;u<q.hd;u++){var v={Dg:0,Eg:0};v.Dg=_.Mm(m.reader);v.Eg=_.W(m.reader);q.lg.push(v)}}n.h.push(q)}g=n}}).M(_.Qe,function(m){var n=new qQ;0<m.reader.Ia()?n.h=_.Qm(m.reader,m.reader.Ia()):(_.Ih(uP,"mdat box is empty!"),
20
+ n.h=new Uint8Array(0));h=n}).parse(a,!1);if(!h)return null;var l=(new oQ).append([d,e]);f&&l.append([f]);b.Be()&&g&&l.append([g]);l=(new pQ).append([c,l]);return new MQ([l,h])},RQ=function(a,b,c,d){var e=d.Be(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=QQ(b,d);if(null===g)return a.request.contentType===_.P?a.data:g;d=g.get(_.Qe);if(a.request.contentType===_.P){e=d.h.buffer;if(c){e=_.S.Dd(e);if((e=(new DOMParser).parseFromString(e,_.tg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
21
+ e.documentElement;if(h&&(d=new KQ(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",_.re],m=0,n=l.length;m<n;m++){b:{var p=f;var q=l[m],u=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(u)){p=
22
+ p.getAttribute(A[0]);break b}}p=null}}f.setAttribute(l[m],JQ(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.S.Wa(e).buffer}else c=e;return c}h=new pQ;a=g.get("mfhd");b=new oQ;l=g.get("tfhd");m=new kQ(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");l.h=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.j;m++)l.push(10+6*c.h[m].hd);else g=8;b.append([c,new uQ,new vQ(g,l,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=
23
+ new MQ([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},SQ=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},TQ=function(a,b,c){a=_.Un(a);c&&a.version!==c&&(a=_.AC(a,c));return{initData:_.yC(a),initDataType:_.vd,keyId:b,periodId:null}},VQ=function(){this.w=this.h=this.f=
24
+ this.C=null;this.N=1;this.R=0;this.l="";this.B=this.a=null;this.g=new _.K("clpp.smooth.SmoothParser");this.J=!1;this.j=this.A=null;this.L=UQ;this.H=0;this.D=this.I=Infinity;this.o=[];this.K=this.an.bind(this);this.G=new Map},WQ=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.Mj(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
+ c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.C.networkingEngine.fetch(c),_.y(f,d.P,2);e=f.f;a.l=e.uri;return f["return"](e)})},cR=function(a,b){var c=null;try{var d=new DOMParser;try{var e=_.S.Dd(b);var f=d.parseFromString(e.trim(),_.tg)}catch(xI){throw xI;}if(f&&f.documentElement.tagName===_.ec)var g=f.documentElement;c=g&&0<g.getElementsByTagName("parsererror").length?null:g}catch(xI){}if(!c)throw a.g.error("Unable to parse manifest"),new _.N(_.O,4,4033,a.l);var h=+XQ(a,c,"MajorVersion"),
26
+ l=+XQ(a,c,"MinorVersion"),m=+c.getAttribute("TimeScale")||1E7,n=+XQ(a,c,"Duration"),p="TRUE"===c.getAttribute("IsLive"),q=+c.getAttribute("LookAheadCount"),u=+c.getAttribute("DVRWindowLength")||Infinity,v=_.Gn(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+h+"."+l))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.N(_.O,4,4036,a.l);p?(YQ(a,ZQ),a.A=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),n=Infinity):YQ(a,UQ);a.a={startTime:0,delay:0,
27
+ duration:n/m,yf:u/m,Td:0};if(v){var z=a.f.playreadyVersion,A=[],G=_.Gn(v,"ProtectionHeader")[0],F=_.Aj(_.In(G)||""),C=_.Un(F).a;A.push(SQ(_.Vd,{initData:_.yC(_.Nn(C)),initDataType:_.vd,keyId:C,periodId:null},[C]));A.push(SQ(_.Td,TQ(F,C,z),[C]));a.o=A}var H=[],Q=_.Gn(c,"StreamIndex");if(!Q.length)throw a.g.error("No streams found!"),new _.N(_.O,4,4034,a.l);for(var R=0;R<Q.length;R++){for(var na,da=a,Ba=Q[R],ab=XQ(da,Ba,"Type"),bb=+Ba.getAttribute("Chunks"),Qa=Ba.getAttribute("Subtype"),Ca=Ba.getAttribute("Language")||
28
+ _.yg,fb=_.gj(Ca),pc=Ba.getAttribute("Name")||"",Eg=+Ba.getAttribute(_.Ab),Fg=+Ba.getAttribute(_.zb),wn=XQ(da,Ba,"Url"),hu=+Ba.getAttribute("TimeScale")||null,fd=[],xn=_.Gn(Ba,_.Ub),Su=0;Su<xn.length;Su++){var Ef=void 0,rc=void 0,Tu=void 0,Ff=da,Gd=xn[Su],Uu=ab,MU=+Gd.getAttribute("Index"),NU=+XQ(Ff,Gd,"Bitrate"),AI=NaN,BI=NaN,to=NaN,Vu=NaN,CI=NaN,DI=NaN,EI=NaN,FI=Gd.getAttribute("FourCC");switch(Uu){case _.r:AI=+XQ(Ff,Gd,_.zb);BI=+XQ(Ff,Gd,_.Ab);break;case _.cd:Vu=+Gd.getAttribute("Channels")||2,
29
+ to=+XQ(Ff,Gd,"SamplingRate"),DI=+XQ(Ff,Gd,"AudioTag"),CI=+XQ(Ff,Gd,"BitsPerSample"),EI=+XQ(Ff,Gd,"PacketSize")}var Wu=String(Gd.getAttribute("CodecPrivateData"));if(Uu===_.cd&&!Wu){var GI=Vu,HI={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},uo=HI[to];if("AACH"===FI){rc=new Uint8Array(4);var II=HI[2*to];rc[0]=40|uo>>1;rc[1]=uo<<7|GI<<3|II>>1;rc[2]=II<<7|8;rc[3]=0;Ef=new Uint16Array(2);Ef[0]=(rc[0]<<8)+rc[1];Ef[1]=(rc[2]<<8)+rc[3];Tu=Ef[0].toString(16)+
30
+ Ef[1].toString(16)}else rc=new Uint8Array(2),rc[0]=16|uo>>1,rc[1]=uo<<7|GI<<3,Ef=new Uint16Array(1),Ef[0]=(rc[0]<<8)+rc[1],Tu=Ef[0].toString(16);Wu=Tu.toUpperCase()}var OU={id:Ff.R++,type:Uu,index:MU,bitrate:NU,se:Wu,maxHeight:AI,maxWidth:BI,Zd:to,Fg:Vu,Tn:DI,Xi:CI,jo:EI,Kk:FI,segmentIndex:null};fd.push(OU)}na=fd;for(var Me=[],JI=_.Gn(Ba,"c"),qk=0;qk<JI.length;qk++){var Xu=JI[qk],fe=parseInt(Xu.getAttribute("t"),10),di=parseInt(Xu.getAttribute("d"),10),Yu=parseInt(Xu.getAttribute("r"),10),rk=0;if(isNaN(fe)&&
31
+ isNaN(di))throw da.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.N(_.O,4,4037,da.l);0===qk&&isNaN(fe)&&(rk=fe=0);if(0<qk){var Ig=Me[Me.length-1];rk=Ig.n+1;Ig.d||(Ig.d=fe-Ig.t);fe||(fe=Ig.t+Ig.d);di||(di=fe-Ig.t)}Me.push({n:rk,d:di,t:fe});if(Yu){Yu--;for(var KI=0;KI<Yu;KI++){var vo=Me[Me.length-1];rk=vo.n+1;fe=vo.t+vo.d;di=vo.d;Me.push({n:rk,d:di,t:fe})}}}da.ud()||Me.length===bb||da.g.warn("Number of fragments ("+bb+") differs from number of chunks ("+
32
+ Me.length+").");H.push({type:ab,Xn:bb,mn:Qa,language:fb,Sd:Ca,name:pc,maxWidth:Eg,maxHeight:Fg,Cn:wn,tracks:na,nh:Me,timescale:hu})}var Gf={ho:h,Ph:l,timescale:m,duration:n,isLive:p,fo:q,yf:u,If:!1,streams:H};if(a.h&&a.w)return $Q(a,Gf),Promise.resolve();a.G.clear();var Zu=Gf.timescale,wo=Gf.duration,QU=BQ(Gf.streams,_.cd),RU=BQ(Gf.streams,_.r),SU=BQ(Gf.streams,_.P),LI=[],xo=aR(a,wo,Zu,QU),yo=aR(a,wo,Zu,RU),TU=aR(a,wo,Zu,SU);xo.length||(xo=[null]);yo.length||(yo=[null]);for(var av=0;av<yo.length;av++)for(var bv=
33
+ 0;bv<xo.length;bv++)LI.push(bR(a,yo[av],xo[bv]));var MI={id:"ID",configurationId:void 0,startTime:0,endTime:wo,variants:LI,textStreams:TU,thumbStreams:[]};var VU=Gf.streams,cv=a.a.startTime,NI=a.a.delay,dv=a.I,OI=Math.min(a.a.duration||Infinity,dv),ev=a.ud(),WU=a.a.yf,XU=a.a.Td,PI=a.H,QI=isFinite(a.D)?a.D:0;if(ev)OI=Infinity,cv=Date.now()/1E3-XU,a.a.startTime=cv,NI=3*PI;else for(var YU=isFinite(dv)?dv:a.a.duration,RI=_.w(VU),fv=RI.next();!fv.done;fv=RI.next())for(var SI=_.w(fv.value.tracks),gv=SI.next();!gv.done;gv=
34
+ SI.next()){var TI=gv.value;TI.segmentIndex.offset(-QI);_.hD(TI.segmentIndex,YU)}var UI=a.f.timeline||{};UI.type=void 0;a.B=new _.pD(UI,cv,NI,!ev,!0);a.B.f=OI;_.xD(a.B,PI);a.B.A=WU;ev||a.B.offset(-QI);a.C.filterAllPeriods([MI]);a.h={presentationTimeline:a.B,periods:[MI],minBufferTime:0};Promise.resolve();a.J||(a.C.networkingEngine.Nc(a.K),a.J=!0);a.w=Gf;return Promise.resolve()},$Q=function(a,b){for(var c=0;c<a.w.streams.length;c++)for(var d=b.streams[c],e={},f=_.w(a.w.streams[c].tracks),g=f.next();!g.done;e=
35
+ {Sb:e.Sb},g=f.next())if(e.Sb=g.value,g=d.tracks.find(function(l){return function(m){return m.type===l.Sb.type&&m.bitrate===l.Sb.bitrate}}(e))){zQ(e.Sb,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=dR(a,a.w.timescale,d,g);g=e.Sb.segmentIndex;g.pa(h);(h=a.a.yf)&&_.ND(g,_.MD(g)-h).forEach(function(l){l.Sa().forEach(function(m){a.G["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.Sb.type+" track with bitrate "+(e.Sb.bitrate+
36
+ ". Skipping update."))},aR=function(a,b,c,d){for(var e=[],f={Ic:0};f.Ic<d.length;f={Ic:f.Ic},f.Ic++){var g=d[f.Ic].tracks.map(function(h){return function(l){var m=d[h.Ic],n=dR(a,c,m,l);n=new _.LD(n);var p=null;m.type!==_.P&&(p=eR(a,b,c,m,l));l.segmentIndex=n;var q=_.rJ++,u=Promise.resolve.bind(Promise),v=n.find.bind(n),z=n.get.bind(n),A=n.od.bind(n),G=n.getDuration.bind(n),F=fR[m.type],C="";switch(m.type){case _.r:C=l.se;var H=/00000001[0-9]7/.exec(C);C="avc1."+(H&&H[0]?C.substr(C.indexOf(H[0])+10,
37
+ 6):"42c00c");a.g.debug("VIDEO CODECS: ",C);break;case _.cd:C=l.se,H=2,"AACH"===l.Kk?H=5:C&&(H=(parseInt(C.substr(0,2),16)&248)>>3),C="mp4a.40."+H,a.g.debug("AUDIO CODECS: ",C)}H=m.type===_.P?gR[m.mn]:void 0;return{id:q,originalId:null,lo:null,createSegmentIndex:u,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:A,getDuration:G,segmentIndex:n,segmentLookupStrategy:_.hC,initSegmentReference:p,mimeType:F,codecs:C,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||
38
+ void 0,kind:H,encrypted:a.Jf(),keyId:null,language:m.language,originalLanguage:m.Sd,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.Fg||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},dR=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.nh.forEach(function(h,l){var m=h.d/g;if(0===l){var n=h.t/g;a.D=Math.min(a.D,n)}else n=f[l-1].endTime;var p=n+m,q=yQ(a.l,c,l,d);a.H=Math.max(a.H,m);f.push(new _.ej(l,n,p,function(){return[q]},
39
+ 0,null,0,null,!0,g));a.G.set(q,n);e+=m});if(c.type===_.r||c.type===_.cd)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Td?a.a.Td=b.endTime:a.a.Td=Math.min(a.a.Td,b.endTime);return f},eR=function(a,b,c,d,e){b=AQ(b,d.timescale||c,e);c={isLive:a.ud.bind(a),Be:a.Jf.bind(a),Sk:function(){return 1},ye:a.qh.bind(a)};d=new Uint8Array(0);try{d=OQ(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.N(_.O,3,4035,g);}var f="data:text/plain;base64,"+_.zj(d);return new _.MC(function(){return[f]},
40
+ 0,null,null,!0)},bR=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.yg;return c||b?{id:a.N++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},XQ=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.N(_.O,4,4038,a.l,c);},hR=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Mb.bind(a),b))},YQ=function(a,b){var c=b===UQ;a.h&&a.h.presentationTimeline&&
41
+ _.sD(a.h.presentationTimeline,c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.L=b},iR=function(){};DP.prototype.append=function(a){a=void 0===a?[]:a;for(var b=0;b<a.length;b++)this.f.push(a[b]),a[b].parent=this;return this};DP.prototype.get=function(a){if(this.type===a)return this;for(var b=0;b<this.f.length;b++){if(this.f[b].type===a)return this.f[b];var c=this.f[b].get(a);if(c)return c}return null};
42
+ DP.prototype.a=function(){var a=Math.pow(2,32)-1;var b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.f.length)for(var c=0;c<this.f.length;c++)b+=this.f[c].a();this.size>a&&(b+=8);return b};
43
+ DP.prototype.write=function(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.V(a,1):_.V(a,this.size);_.Hm(a,CP(this.type));this.size>b&&wP(a,this.size);"uuid"===this.type&&_.Hm(a,null);if(0<this.f.length&&!this.A)for(b=0;b<this.f.length;b++)this.f[b].write(a),this.f[b].a(),a.getPosition()};_.x(Z,DP);Z.prototype.a=function(){return 4+DP.prototype.a.call(this)};Z.prototype.write=function(a){DP.prototype.write.call(this,a);xP(a,this.version);yP(a,this.flags)};
44
+ _.x(EP,DP);EP.prototype.a=function(){return this.h.byteLength+DP.prototype.a.call(this)-this.offset};EP.prototype.write=function(a){DP.prototype.write.call(this,a);_.Hm(a,this.h,this.offset);a.getPosition()};_.x(FP,Z);FP.prototype.a=function(){return this.h.byteLength+Z.prototype.a.call(this)-this.offset};FP.prototype.write=function(a){Z.prototype.write.call(this,a);_.Hm(a,this.h,this.offset);a.getPosition()};_.x(GP,DP);
45
+ GP.prototype.a=function(){var a=this.j.length;a=a+4+this.h.join("").length;return a+DP.prototype.a.call(this)};GP.prototype.write=function(a){DP.prototype.write.call(this,a);_.Hm(a,CP(this.j));_.V(a,this.Ph);_.Hm(a,CP(this.h.join("")));a.getPosition()};_.x(HP,DP);_.x(IP,DP);_.x(JP,Z);JP.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;a=a+44+this.h.length;return a+=Z.prototype.a.call(this)};
46
+ JP.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(wP(a,0),wP(a,0),_.V(a,this.timescale),wP(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));_.V(a,65536);zP(a,this.volume);zP(a,0);_.V(a,0);_.V(a,0);for(var b=0;b<this.h.length;b++)xP(a,this.h[b]);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,this.j);a.getPosition()};_.x(KP,DP);_.x(LP,Z);LP.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
+ LP.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);_.V(a,1);_.V(a,0);_.V(a,0);_.V(a,0);a.getPosition()};_.x(MP,Z);MP.prototype.a=function(){var a=0;a=1===this.version?a+32:a+20;a=a+24+this.h.length;return a+Z.prototype.a.call(this)};
48
+ MP.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(wP(a,0),wP(a,0),_.V(a,this.j),_.V(a,0),wP(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.j),_.V(a,0),_.V(a,this.duration*this.timescale));_.V(a,0);_.V(a,0);zP(a,0);zP(a,0);zP(a,this.volume);zP(a,0);for(var b=0;b<this.h.length;b++)xP(a,this.h[b]);zP(a,this.width);zP(a,0);zP(a,this.height);zP(a,0);a.getPosition()};_.x(NP,Z);NP.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
49
+ NP.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(wP(a,0),wP(a,0),_.V(a,this.timescale),wP(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));zP(a,this.language);zP(a,0);a.getPosition()};_.x(OP,Z);OP.prototype.a=function(){return 33+Z.prototype.a.call(this)};
50
+ OP.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);this.h===_.r?_.Hm(a,CP("vide")):_.Hm(a,CP("soun"));_.V(a,0);_.V(a,0);_.V(a,0);this.h===_.r?_.Hm(a,CP("VideoHandler\x00")):_.Hm(a,CP("SoundHandler\x00"));a.getPosition()};_.x(PP,Z);PP.prototype.a=function(){return 2+this.h.byteLength+Z.prototype.a.call(this)};PP.prototype.write=function(a){Z.prototype.write.call(this,a);zP(a,0);_.Hm(a,this.h);a.getPosition()};_.x(QP,DP);QP.prototype.a=function(){return 8+DP.prototype.a.call(this)};
51
+ QP.prototype.write=function(a){DP.prototype.write.call(this,a);_.V(a,0);zP(a,0);zP(a,1)};_.x(RP,QP);RP.prototype.a=function(){return 70+QP.prototype.a.call(this)};RP.prototype.write=function(a){QP.prototype.write.call(this,a);zP(a,0);zP(a,0);_.V(a,0);_.V(a,0);_.V(a,0);zP(a,this.width);zP(a,this.height);_.V(a,4718592);_.V(a,4718592);_.V(a,0);zP(a,1);xP(a,10);_.Hm(a,CP("AVC Coding",31));zP(a,this.depth);BP(a,-1)};_.x(SP,QP);SP.prototype.a=function(){return 20+QP.prototype.a.call(this)};
52
+ SP.prototype.write=function(a){QP.prototype.write.call(this,a);_.V(a,0);_.V(a,0);zP(a,this.channelCount);zP(a,this.sampleSize);BP(a,0);zP(a,0);zP(a,this.sampleRate);zP(a,0)};_.x(TP,RP);TP.prototype.write=function(a){RP.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.x(UP,TP);_.x(VP,SP);VP.prototype.write=function(a){SP.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.x(WP,VP);_.x(XP,DP);
53
+ XP.prototype.a=function(){for(var a=7,b=0;b<this.Va.length;b++)a+=2,a+=this.Va[b].byteLength;for(b=0;b<this.Va.length;b++)a+=2,a+=this.bc[b].byteLength;return a+DP.prototype.a.call(this)};
54
+ XP.prototype.write=function(a){DP.prototype.write.call(this,a);xP(a,this.version);xP(a,this.h);xP(a,this.j);xP(a,this.level);xP(a,255);xP(a,224|this.Va.length);for(var b=0;b<this.Va.length;b++)zP(a,this.Va[b].length),_.Hm(a,this.Va[b]);xP(a,this.bc.length);for(b=0;b<this.bc.length;b++)zP(a,this.bc[b].length),_.Hm(a,this.bc[b]);a.getPosition()};_.x(YP,Z);YP.prototype.a=function(){return 22+(this.Ub.byteLength+3)+Z.prototype.a.call(this)};
55
+ YP.prototype.write=function(a){Z.prototype.write.call(this,a);xP(a,3);xP(a,23+this.Ub.byteLength);zP(a,1);xP(a,0);xP(a,4);xP(a,15+this.Ub.byteLength);xP(a,64);xP(a,21);yP(a,0);_.V(a,0);_.V(a,0);xP(a,5);xP(a,this.Ub.byteLength);_.Hm(a,this.Ub);_.Hm(a,new Uint8Array([6,1,2]));a.getPosition()};_.x(ZP,Z);ZP.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};ZP.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.Hm(a,CP(this.location));a.getPosition()};
56
+ _.x($P,Z);$P.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};$P.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(aQ,DP);_.x(bQ,Z);bQ.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};
57
+ bQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(cQ,Z);cQ.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};cQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(dQ,Z);
58
+ dQ.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};dQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(eQ,Z);eQ.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};
59
+ eQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(fQ,Z);fQ.prototype.a=function(){return 8+Z.prototype.a.call(this)};fQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);_.V(a,0);a.getPosition()};_.x(gQ,Z);gQ.prototype.a=function(){return 4+Z.prototype.a.call(this)};gQ.prototype.write=function(a){Z.prototype.write.call(this,a);BP(a,0);zP(a,0);a.getPosition()};
60
+ _.x(hQ,DP);_.x(iQ,DP);_.x(jQ,DP);_.x(kQ,Z);kQ.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};kQ.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?wP(a,this.baseMediaDecodeTime):_.V(a,this.baseMediaDecodeTime);a.getPosition()};_.x(lQ,Z);lQ.prototype.a=function(){return 4+Z.prototype.a.call(this)};lQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);a.getPosition()};_.x(mQ,Z);
61
+ mQ.prototype.a=function(){var a=4;this.flags&jR&&(a+=4);this.flags&kR&&(a+=4);for(var b=0;b<this.h;b++)this.flags&lR&&(a+=4),this.flags&mR&&(a+=4),this.flags&nR&&(a+=4),this.flags&oR&&(a+=4);return a+Z.prototype.a.call(this)};
62
+ mQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&jR&&(a.getPosition(),AP(a,this.l));this.flags&kR&&_.V(a,this.o);for(var b=0;b<this.h;b++)this.flags&lR&&_.V(a,this.w[b]),this.flags&mR&&_.V(a,this.sampleSize[b]),this.flags&nR&&_.V(a,this.B[b]),this.flags&oR&&(0===this.version?_.V(a,this.j[b]):AP(a,this.j[b]));a.getPosition()};var jR=1,kR=4,lR=256,mR=512,nR=1024,oR=2048;_.x(nQ,Z);
63
+ nQ.prototype.a=function(){var a=4;this.flags&pR&&(a+=8);this.flags&qR&&(a+=4);this.flags&rR&&(a+=4);this.flags&sR&&(a+=4);this.flags&tR&&(a+=4);return a+Z.prototype.a.call(this)};nQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&pR&&wP(a,this.j);this.flags&qR&&_.V(a,this.B);this.flags&rR&&_.V(a,this.l);this.flags&sR&&_.V(a,this.w);this.flags&tR&&_.V(a,this.o);a.getPosition()};var pR=1,qR=2,rR=8,sR=16,tR=32;_.x(oQ,DP);_.x(pQ,DP);_.x(qQ,DP);
64
+ qQ.prototype.a=function(){return this.h.byteLength+DP.prototype.a.call(this)};qQ.prototype.write=function(a){DP.prototype.write.call(this,a);0<this.h.byteLength&&_.Hm(a,this.h)};_.x(rQ,Z);rQ.prototype.a=function(){var a=20;1===this.h&&0===this.j&&(a=a+1+this.l.length);return a+Z.prototype.a.call(this)};
65
+ rQ.prototype.write=function(a){Z.prototype.write.call(this,a);xP(a,0);0===this.version?xP(a,0):xP(a,0);xP(a,this.h);xP(a,this.j);_.Hm(a,_.Bj(this.o));if(1===this.h&&0===this.j){xP(a,0);for(var b=0;b<this.l.length;b++)xP(a,this.l[b])}a.getPosition()};_.x(sQ,Z);sQ.prototype.a=function(){var a=8;this.flags&1&&(a+=CP(this.Pb).byteLength);return a+Z.prototype.a.call(this)};sQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.Hm(a,CP(this.h));_.V(a,this.j);this.flags&1&&_.Hm(a,CP(this.Pb));a.getPosition()};
66
+ _.x(tQ,DP);tQ.prototype.a=function(){return CP(this.h).byteLength+DP.prototype.a.call(this)};tQ.prototype.write=function(a){DP.prototype.write.call(this,a);_.Hm(a,CP(this.h));a.getPosition()};_.x(uQ,Z);uQ.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=4;for(var b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+Z.prototype.a.call(this)};
67
+ uQ.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));_.V(a,1);for(var b=0;1>b;b++)0===this.version?_.V(a,this.offset[b]):wP(a,this.offset[b]);a.getPosition()};_.x(vQ,Z);vQ.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=5;0===this.h&&(a+=this.l.length);return a+Z.prototype.a.call(this)};
68
+ vQ.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));xP(a,this.h);_.V(a,this.j);if(0===this.h)for(var b=0;b<this.j;b++)xP(a,this.l[b]);a.getPosition()};_.x(wQ,Z);wQ.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.j;b++)if(a+=this.h[b].Ch.byteLength,this.flags&2){a+=2;for(var c=0;c<this.h[b].hd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
69
+ wQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.j);this.flags&1&&xP(a,this.l);for(var b=0;b<this.j;b++)if(_.Hm(a,this.h[b].Ch),this.flags&2){zP(a,this.h[b].hd);for(var c=0;c<this.h[b].hd;c++)zP(a,this.h[b].lg[c].Dg),_.V(a,this.h[b].lg[c].Eg)}a.getPosition()};var DQ=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,EQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,FQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,GQ=/^(\d*\.?\d*)f$/,HQ=/^(\d*\.?\d*)t$/,IQ=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;MQ.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};MQ.prototype.write=function(){this.f=LQ(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var PQ=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.t=VQ.prototype;_.t.configure=function(a){this.f=a};_.t.start=function(a,b){var c=this;this.C=b;var d=_.fh(new Set([a,xQ(a)])).concat();return WQ(this,d).then(function(e){return cR(c,e.data).then(function(){hR(c,c.A);return c.h})})};_.t.requestStop=function(){};_.t.stop=function(){this.C&&this.C.networkingEngine.Yd(this.K);this.A=this.w=this.h=this.f=this.C=null;this.j&&(clearTimeout(this.j),this.j=null);this.J=!1;this.I=this.D=Infinity;return Promise.resolve()};
70
+ _.t.update=function(){var a=this;if(this.ud())return WQ(this,[this.l]).then(function(b){return cR(a,b.data).then(function(){return a.h})})["catch"](function(b){if(a.C)a.C.onError(b)})};_.t.setCurrentVariant=function(){};_.t.Mb=function(){var a=this;this.g.debug(_.$B);this.C&&(this.j=null,this.update().then(function(){hR(a,a.A)})["catch"](function(b){a.C&&(a.C.onError(b),1===b.severity&&hR(a,100))}))};_.t.ud=function(){return this.L===ZQ};_.t.Jf=function(){return 0<this.o.length};
71
+ _.t.qh=function(a){var b=null;if(this.o.length)for(var c=0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b};
72
+ _.t.an=function(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);var b=a.request.timescale||this.w.timescale,c={isLive:this.ud.bind(this),Be:this.Jf.bind(this),Sk:function(){return 1},ye:this.qh.bind(this)},d=!1,e=new _.N(_.O,3,4035,null),f=null;try{var g=this.G.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=RQ(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)};var fR={video:_.Mg,audio:_.hd,text:_.$c},UQ=_.oc,ZQ="LIVE",gR={En:_.rd,Mn:_.pg};_.x(iR,_.Ts);iR.prototype.f=function(){_.St.ism=VQ;_.Qt[_.ad]=VQ};iR.prototype.a=function(){_.oE("ism");_.pE(_.ad)};iR.prototype.id=function(){return _.gg};_.J("clpp.smooth.SmoothComponent",iR);};
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));}
@@ -1,30 +1,30 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var iy="No thumbnail found for position: ",jy="Position is out of range: ",ky="Thumbnail URL is mandatory",ly="Wrong gridSize format",my="clpp.thumbnails",ny=function(){this.log=new _.K(my);this.player=null;this.a=[];this.w=!1},py=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Ye&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return oy(a,0,e,!!f)})},Promise.resolve())},oy=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return qy(a,d).then(function(){return a.a[b].load()}).then(function(){return oy(a,
3
- e,c,d)})},qy=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.qp)c();else a.player.one(_.md,function(){c()})})},ry=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.pa=p;this.mk=h;this.Ym=l;this.gl=m;this.hl=n;this.Hf=null},sy=function(){ny.call(this);
4
- this.f=null;this.o=this.h=1;this.j=0},ty=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Ud=new _.Oj},uy=function(){this.g=new _.K(my);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Oj},vy=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.Ud.resolve()})},xy=function(a,b){return wy(a,b).then(function(c){return new ry(c,b.time,b.duration)})},wy=function(a,b){return b.load().then(function(){var c=_.lj(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
- _.vj(c)})},yy=function(){ny.call(this);this.f=null},zy=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},Ay=function(){ny.apply(this,arguments)},By=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Kd:c,qg:d,yh:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Cy=function(){this.g=new _.K(my);this.a=this.m=null},Dy=function(a){return a.some(function(b){return 0<
6
- b.thumbStreams.length})},Iy=function(a){return a?a===Ey||a===Fy?new sy:a===Gy?new yy:a===Hy?new uy:null:null},Jy=function(a){if(!a)return null;a=new _.qk(a);return a.path.match(/.*\.vtt$/i)?Gy:a.path.match(/.*\.bif$/i)?Hy:a.path.match(/.*\.(png|jpg|jpeg)$/i)?Ey:null},Ky=function(){};ny.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Qf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&py(c,b.preload)})};ry.prototype.raw=function(){return this.pa.cloneNode(!1)};
7
- ry.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(_.ae);e.style.width=c+_.Nf;e.style.height=d+_.Nf;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.pa.naturalWidth||this.pa.width))+"px "+Math.ceil(d/
8
- this.height*(this.pa.naturalHeight||this.pa.height))+_.Nf;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Nf;e.style.backgroundPositionY="-"+f*d+_.Nf;return e};
9
- ry.prototype.load=function(){var a=this;this.Hf||(this.Hf=new Promise(function(b,c){function d(){a.width||(a.width=(a.pa.naturalWidth||a.pa.width)/a.mk);a.height||(a.height=(a.pa.naturalHeight||a.pa.height)/a.Ym);a.x||(a.x=a.width*a.gl);a.y||(a.y=a.height*a.hl)}if(a.pa.src&&a.pa.complete)d(),b(a);else{var e=null,f=function(){d();a.pa.removeEventListener("load",f);a.pa.removeEventListener(_.se,e);b(a)};e=function(g){a.pa.removeEventListener("load",f);a.pa.removeEventListener(_.se,e);c(new _.P(1,9,
10
- 2014,"Failed to load thumbnail.",g))};a.pa.addEventListener("load",f);a.pa.addEventListener(_.se,e);a.pa.src=a.src}}));return this.Hf};_.J("clpp.thumbnails.Thumbnail",ry);ry.prototype.load=ry.prototype.load;ry.prototype.element=ry.prototype.element;ry.prototype.raw=ry.prototype.raw;_.x(sy,ny);
11
- sy.prototype.init=function(a,b){if(!b||!b.url)throw new _.P(1,9,7100,ky);if("GRID"===b.mode&&!b.gridSize)throw new _.P(1,9,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.P(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 _.P(1,9,7100,ly);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
- new _.P(1,9,7100,ly);}ny.prototype.init.call(this,a,b)};sy.prototype.get=function(a){var b=this,c,d,e,f;return _.H(function(g){if(1==g.a){c=b.player.getDuration();if(0>a||a>c)throw new _.P(1,9,2014,jy+a);d=b.f.duration;e=Math.floor(a/d);f=b.a[e];if(!f)throw new _.P(1,9,2014,"No thumbnail found for position "+a+" at index "+e);return _.y(g,f.load(),2)}return g["return"](f)})};
13
- sy.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getDuration(),b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);for(var c=this.f.templateKey||"$index$",d=0;d<a;d++)for(var e=this.f.url.replace(c,String(d+1)),f=new Image,g=0;g<b;g++)this.a.push(new ry(e,this.j*(d*b+g),this.j,0,0,0,0,this.h,this.o,g%this.h,Math.floor(g/this.h),f));return Promise.resolve()};ty.prototype.load=function(){return this.Ud};
14
- uy.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,ky);var d=b.url,e=_.Jj(d);e.type=_.Ij;a.getNetworkEngine().fetch(e).P.then(function(f){f=f.data;var g=_.lj(c.f);f=_.lj(f);for(var h=g.byteLength+f.byteLength,l=new ArrayBuffer(h),m=new DataView(l),n=0,p=0,q=g.byteLength;p<q;p++)m.setUint8(n,g[p]),n+=1;g=0;for(p=f.byteLength;g<p;g++)m.setUint8(n,f[g]),n+=1;c.f=l;c.g.info("Appended "+f.byteLength+" bytes.Total data now "+(h+" bytes."));l=c.f;f=_.lj(l);n=String.fromCharCode.apply(null,
15
- Ly);g=Array.prototype.slice.call(f,0,8);f=64;h=0;m=!1;if(n===String.fromCharCode.apply(null,g))for(l=new DataView(l,16,20),l=l.getUint32(0,!0),0===l&&(l=1E3);!m;){h+=1;g=l;n=new DataView(c.f,f);m=n.getUint32(0,!0);g=m*g/1E3;n=n.getUint32(4,!0);n=new ty(g,n);if(g=c.a.length)g=c.a[g-1],g.length=n.offset-g.offset,g.duration=n.time-g.time;c.a.push(n);f+=8;(m=4294967295===m)&&c.h.resolve();if(1E5<h)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
16
- vy(c)})["catch"](function(f){c.g.error("[BIF] Error while loading thumbnails '\n + 'URL: "+d,f);a.onError(new _.P(1,9,2013,"Error while loading and parsing BIF thumbnails.",f))})};uy.prototype.get=function(a){var b=this,c,d;return _.H(function(e){switch(e.a){case 1:if(0>a)throw new _.P(1,9,2014,jy+a);return _.y(e,b.h,2);case 2:c=b.a.find(function(f){return a>=f.time&&a<f.time+f.duration});if(!c)throw new _.P(1,9,2014,iy+a);return _.y(e,xy(b,c),3);case 3:return d=e.f,_.y(e,d.load(),4);case 4:return e["return"](d)}})};
17
- uy.prototype.Jd=function(){return 0<this.a.length};var Ly=[137,66,73,70,13,10,26,10];_.x(yy,ny);
18
- yy.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,ky);var d=b.url,e=_.Jj(d);e.type=_.Ij;this.f=a.getNetworkEngine().fetch(e).P.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.S.ba(f).split(/\n/);for(var g=0;g<f.length;g++){var h=f[g],l=h.split(" --\x3e ");if(2===l.length){h=f[++g];var m=h.indexOf("\x3d"),n=0>m?[]:h.substr(m+1).split(/,/).map(parseFloat);m=n[0];var p=n[1],q=n[2];n=n[3];var u=h.indexOf("#");h=0>u?h:h.substr(0,u);h.match(/^http|^\/\//)||(h=
19
- d.substr(0,d.lastIndexOf("/"))+"/"+h);u=zy(l[0]);l=zy(l[1])-u;c.a.push(new ry(h,u,l,m,p,q,n,0,0))}}})["catch"](function(f){c.log.error("[VTT] Error while loading thumbnails URL: "+d,f);a.onError(new _.P(1,9,2013,"Error while loading VTT thumbnails.",f))});ny.prototype.init.call(this,a,b)};
20
- yy.prototype.get=function(a){var b=this,c;return _.H(function(d){if(1==d.a){if(0>a)throw new _.P(1,9,2014,jy+a);return _.y(d,b.f,2)}if(3!=d.a){c=b.a.find(function(e){return a>=e.time&&a<e.time+e.duration});if(!c)throw new _.P(1,9,2014,iy+a);return _.y(d,c.load(),3)}return d["return"](c)})};yy.prototype.l=function(){return this.f};_.x(Ay,ny);
21
- Ay.prototype.get=function(a){function b(){return new _.P(1,9,2014,iy+a)}var c=this,d,e,f,g,h,l,m,n,p,q,u,v,z;return _.H(function(C){if(1==C.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.P(1,9,2014,jy+a);d=c.player.getPeriods();for(var I=null,F=_.w(d),D=F.next();!D.done;D=F.next())D=D.value,D.startTime<=a&&(I=D);e=I;if(!e)throw c.log.error("Could not find period for specified position",a),b();f=e.thumbStreams.sort(c.f)[0];if(!f)throw c.log.error("Could not find thumb stream for specified position",a),
22
- b();g=f.findSegmentPosition(a-e.startTime);if(null===g||void 0===g)throw c.log.error("Could not find segment index for specified position",a),b();h=f.getSegmentReference(g);if(!h)return C.F(2);l=By(h,f);m=Math.floor((a-h.startTime)/l.durationPerTile);0<c.a.length?(p=f.findSegmentPosition(0),null!==p&&(n=c.a[(g-p)*l.yh+m])):(q=h.Ra())&&0<q.length&&(v=u=0,z=h.startTime,1<l.yh&&(u=m%l.Kd,v=Math.floor(m/l.Kd),z+=m*l.durationPerTile),n=new ry(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.Kd,l.qg,
23
- u,v));return n?_.y(C,n.load(),4):C.F(2)}if(2!=C.a)return C["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};Ay.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
- Ay.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.w(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.O.R(d=b.getSegmentReference(c++));)for(var e=By(d,b),f=d.Ra()[0],g=new Image,h=d.startTime,l=0;l<e.qg;++l)for(var m=0;m<e.Kd;++m)this.a.push(new ry(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Kd,e.qg,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.t=Cy.prototype;_.t.onPlayerCreated=function(a){this.m=a};_.t.onPlayerWillDestroy=function(){this.m=null};_.t.onPlayerWillRelease=function(){this.a=null};
25
- _.t.onContentWillLoad=function(a){var b=this,c=a.getConfiguration().thumbnails;if(c)if(!1===c.enabled)this.g.info("Thumbnails disabled.");else{var d=c.mode||null;d||(d=Jy(c.url||null));(this.a=Iy(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Ke,function(){b.g.info("Initialize thumbnails provider");try{b.a.init(a,c)}catch(e){b.m.onError(e)}})):this.g.warn("Unknown thumbnail mode",d)}else this.a=null};
26
- _.t.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);if(!this.a&&(c=(c=a.getConfiguration())&&c.thumbnails,!c||void 0===c.enabled||c.enabled)){var d=a.getPeriods();if(Dy(d)){this.a=new Ay;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.t.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.P(1,9,2014,"Thumbnail format is not supported"))};_.t.id=function(){return"thumbnails"};_.J("clpp.thumbnails.ThumbnailsPlugin",Cy);Cy.prototype.get=Cy.prototype.get;Cy.Id="thumbnails";
27
- Ky.prototype.create=function(){return new Cy};_.Xq(new Ky);var Ey="SINGLE",Fy="GRID",Gy="WEBVTT",Hy="BIF";};
2
+ var f=function(window){var ry="No thumbnail found for position: ",sy="Position is out of range: ",ty="Thumbnail URL is mandatory",uy="Wrong gridSize format",vy="clpp.thumbnails",wy=function(){this.log=new _.K(vy);this.player=null;this.a=[];this.w=!1},yy=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.$e&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return xy(a,0,e,!!f)})},Promise.resolve())},xy=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return zy(a,d).then(function(){return a.a[b].load()}).then(function(){return xy(a,
3
+ e,c,d)})},zy=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.sp)c();else a.player.one(_.nd,function(){c()})})},Ay=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.qa=p;this.pk=h;this.bn=l;this.il=m;this.jl=n;this.Kf=null},By=function(){wy.call(this);
4
+ this.f=null;this.o=this.h=1;this.j=0},Cy=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Wd=new _.Rj},Dy=function(){this.g=new _.K(vy);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Rj},Ey=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.Wd.resolve()})},Gy=function(a,b){return Fy(a,b).then(function(c){return new Ay(c,b.time,b.duration)})},Fy=function(a,b){return b.load().then(function(){var c=_.oj(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
+ _.yj(c)})},Hy=function(){wy.call(this);this.f=null},Iy=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},Jy=function(){wy.apply(this,arguments)},Ky=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Md:c,tg:d,Bh:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Ly=function(){this.g=new _.K(vy);this.a=this.m=null},My=function(a){return a.some(function(b){return 0<
6
+ b.thumbStreams.length})},Ry=function(a){return a?a===Ny||a===Oy?new By:a===Py?new Hy:a===Qy?new Dy:null:null},Sy=function(a){if(!a)return null;a=new _.tk(a);return a.path.match(/.*\.vtt$/i)?Py:a.path.match(/.*\.bif$/i)?Qy:a.path.match(/.*\.(png|jpg|jpeg)$/i)?Ny:null},Ty=function(){};wy.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Sf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&yy(c,b.preload)})};Ay.prototype.raw=function(){return this.qa.cloneNode(!1)};
7
+ Ay.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(_.be);e.style.width=c+_.Pf;e.style.height=d+_.Pf;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.qa.naturalWidth||this.qa.width))+"px "+Math.ceil(d/
8
+ this.height*(this.qa.naturalHeight||this.qa.height))+_.Pf;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Pf;e.style.backgroundPositionY="-"+f*d+_.Pf;return e};
9
+ Ay.prototype.load=function(){var a=this;this.Kf||(this.Kf=new Promise(function(b,c){function d(){a.width||(a.width=(a.qa.naturalWidth||a.qa.width)/a.pk);a.height||(a.height=(a.qa.naturalHeight||a.qa.height)/a.bn);a.x||(a.x=a.width*a.il);a.y||(a.y=a.height*a.jl)}if(a.qa.src&&a.qa.complete)d(),b(a);else{var e=null,f=function(){d();a.qa.removeEventListener("load",f);a.qa.removeEventListener(_.te,e);b(a)};e=function(g){a.qa.removeEventListener("load",f);a.qa.removeEventListener(_.te,e);c(new _.N(1,9,
10
+ 2014,"Failed to load thumbnail.",g))};a.qa.addEventListener("load",f);a.qa.addEventListener(_.te,e);a.qa.src=a.src}}));return this.Kf};_.J("clpp.thumbnails.Thumbnail",Ay);Ay.prototype.load=Ay.prototype.load;Ay.prototype.element=Ay.prototype.element;Ay.prototype.raw=Ay.prototype.raw;_.x(By,wy);
11
+ By.prototype.init=function(a,b){if(!b||!b.url)throw new _.N(1,9,7100,ty);if("GRID"===b.mode&&!b.gridSize)throw new _.N(1,9,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.N(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 _.N(1,9,7100,uy);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
+ new _.N(1,9,7100,uy);}wy.prototype.init.call(this,a,b)};By.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 _.N(1,9,2014,sy+a);d=b.f.duration;e=Math.floor(a/d);f=b.a[e];if(!f)throw new _.N(1,9,2014,"No thumbnail found for position "+a+" at index "+e);return _.y(g,f.load(),2)}return g["return"](f)})};
13
+ By.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getDuration(),b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);for(var c=this.f.templateKey||"$index$",d=0;d<a;d++)for(var e=this.f.url.replace(c,String(d+1)),f=new Image,g=0;g<b;g++)this.a.push(new Ay(e,this.j*(d*b+g),this.j,0,0,0,0,this.h,this.o,g%this.h,Math.floor(g/this.h),f));return Promise.resolve()};Cy.prototype.load=function(){return this.Wd};
14
+ Dy.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.N(1,9,7100,ty);var d=b.url,e=_.Mj(d);e.type=_.Lj;a.getNetworkEngine().fetch(e).P.then(function(f){f=f.data;var g=_.oj(c.f);f=_.oj(f);for(var h=g.byteLength+f.byteLength,l=new ArrayBuffer(h),m=new DataView(l),n=0,p=0,q=g.byteLength;p<q;p++)m.setUint8(n,g[p]),n+=1;g=0;for(p=f.byteLength;g<p;g++)m.setUint8(n,f[g]),n+=1;c.f=l;c.g.info("Appended "+f.byteLength+" bytes.Total data now "+(h+" bytes."));l=c.f;f=_.oj(l);n=String.fromCharCode.apply(null,
15
+ Uy);g=Array.prototype.slice.call(f,0,8);f=64;h=0;m=!1;if(n===String.fromCharCode.apply(null,g))for(l=new DataView(l,16,20),l=l.getUint32(0,!0),0===l&&(l=1E3);!m;){h+=1;g=l;n=new DataView(c.f,f);m=n.getUint32(0,!0);g=m*g/1E3;n=n.getUint32(4,!0);n=new Cy(g,n);if(g=c.a.length)g=c.a[g-1],g.length=n.offset-g.offset,g.duration=n.time-g.time;c.a.push(n);f+=8;(m=4294967295===m)&&c.h.resolve();if(1E5<h)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
16
+ Ey(c)})["catch"](function(f){c.g.error("[BIF] Error while loading thumbnails '\n + 'URL: "+d,f);a.onError(new _.N(1,9,2013,"Error while loading and parsing BIF thumbnails.",f))})};Dy.prototype.get=function(a){var b=this,c,d;return _.I(function(e){switch(e.a){case 1:if(0>a)throw new _.N(1,9,2014,sy+a);return _.y(e,b.h,2);case 2:c=b.a.find(function(f){return a>=f.time&&a<f.time+f.duration});if(!c)throw new _.N(1,9,2014,ry+a);return _.y(e,Gy(b,c),3);case 3:return d=e.f,_.y(e,d.load(),4);case 4:return e["return"](d)}})};
17
+ Dy.prototype.Ld=function(){return 0<this.a.length};var Uy=[137,66,73,70,13,10,26,10];_.x(Hy,wy);
18
+ Hy.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.N(1,9,7100,ty);var d=b.url,e=_.Mj(d);e.type=_.Lj;this.f=a.getNetworkEngine().fetch(e).P.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.S.ba(f).split(/\n/);for(var g=0;g<f.length;g++){var h=f[g],l=h.split(" --\x3e ");if(2===l.length){h=f[++g];var m=h.indexOf("\x3d"),n=0>m?[]:h.substr(m+1).split(/,/).map(parseFloat);m=n[0];var p=n[1],q=n[2];n=n[3];var u=h.indexOf("#");h=0>u?h:h.substr(0,u);h.match(/^http|^\/\//)||(h=
19
+ d.substr(0,d.lastIndexOf("/"))+"/"+h);u=Iy(l[0]);l=Iy(l[1])-u;c.a.push(new Ay(h,u,l,m,p,q,n,0,0))}}})["catch"](function(f){c.log.error("[VTT] Error while loading thumbnails URL: "+d,f);a.onError(new _.N(1,9,2013,"Error while loading VTT thumbnails.",f))});wy.prototype.init.call(this,a,b)};
20
+ Hy.prototype.get=function(a){var b=this,c;return _.I(function(d){if(1==d.a){if(0>a)throw new _.N(1,9,2014,sy+a);return _.y(d,b.f,2)}if(3!=d.a){c=b.a.find(function(e){return a>=e.time&&a<e.time+e.duration});if(!c)throw new _.N(1,9,2014,ry+a);return _.y(d,c.load(),3)}return d["return"](c)})};Hy.prototype.l=function(){return this.f};_.x(Jy,wy);
21
+ Jy.prototype.get=function(a){function b(){return new _.N(1,9,2014,ry+a)}var c=this,d,e,f,g,h,l,m,n,p,q,u,v,z;return _.I(function(A){if(1==A.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.N(1,9,2014,sy+a);d=c.player.getPeriods();for(var G=null,F=_.w(d),C=F.next();!C.done;C=F.next())C=C.value,C.startTime<=a&&(G=C);e=G;if(!e)throw c.log.error("Could not find period for specified position",a),b();f=e.thumbStreams.sort(c.f)[0];if(!f)throw c.log.error("Could not find thumb stream for specified position",a),
22
+ b();g=f.findSegmentPosition(a-e.startTime);if(null===g||void 0===g)throw c.log.error("Could not find segment index for specified position",a),b();h=f.getSegmentReference(g);if(!h)return A.F(2);l=Ky(h,f);m=Math.floor((a-h.startTime)/l.durationPerTile);0<c.a.length?(p=f.findSegmentPosition(0),null!==p&&(n=c.a[(g-p)*l.Bh+m])):(q=h.Sa())&&0<q.length&&(v=u=0,z=h.startTime,1<l.Bh&&(u=m%l.Md,v=Math.floor(m/l.Md),z+=m*l.durationPerTile),n=new Ay(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.Md,l.tg,
23
+ u,v));return n?_.y(A,n.load(),4):A.F(2)}if(2!=A.a)return A["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};Jy.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
+ Jy.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.w(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.M.S(d=b.getSegmentReference(c++));)for(var e=Ky(d,b),f=d.Sa()[0],g=new Image,h=d.startTime,l=0;l<e.tg;++l)for(var m=0;m<e.Md;++m)this.a.push(new Ay(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Md,e.tg,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.t=Ly.prototype;_.t.onPlayerCreated=function(a){this.m=a};_.t.onPlayerWillDestroy=function(){this.m=null};_.t.onPlayerWillRelease=function(){this.a=null};
25
+ _.t.onContentWillLoad=function(a){var b=this,c=a.getConfiguration().thumbnails;if(c)if(!1===c.enabled)this.g.info("Thumbnails disabled.");else{var d=c.mode||null;d||(d=Sy(c.url||null));(this.a=Ry(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Ne,function(){b.g.info("Initialize thumbnails provider");try{b.a.init(a,c)}catch(e){b.m.onError(e)}})):this.g.warn("Unknown thumbnail mode",d)}else this.a=null};
26
+ _.t.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);if(!this.a&&(c=(c=a.getConfiguration())&&c.thumbnails,!c||void 0===c.enabled||c.enabled)){var d=a.getPeriods();if(My(d)){this.a=new Jy;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.t.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.N(1,9,2014,"Thumbnail format is not supported"))};_.t.id=function(){return"thumbnails"};_.J("clpp.thumbnails.ThumbnailsPlugin",Ly);Ly.prototype.get=Ly.prototype.get;Ly.Id="thumbnails";
27
+ Ty.prototype.create=function(){return new Ly};_.br(new Ty);var Ny="SINGLE",Oy="GRID",Py="WEBVTT",Qy="BIF";};
28
28
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
29
29
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
30
30
  else{_=this.clpp._;(f.call(g,this));}