@castlabs/prestoplay 6.20.0 → 6.21.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 (65) hide show
  1. package/CHANGELOG.md +35 -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 +109 -110
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +553 -550
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +78 -77
  10. package/cjs/cl.externs.js +81 -97
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -69
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +22 -24
  16. package/cjs/cl.mse.js +305 -305
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.sessions.js +16 -16
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +25 -25
  25. package/cjs/cl.tizen.js +70 -69
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +13 -13
  29. package/cjs/cl.vr.js +18 -18
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +9 -0
  32. package/cjs/cl.youbora.js +38 -20
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +5 -5
  36. package/cl.cast.js +88 -89
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +471 -468
  39. package/cl.crypto.js +8 -8
  40. package/cl.dash.js +74 -72
  41. package/cl.externs.js +71 -99
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +74 -74
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +16 -17
  47. package/cl.mse.js +276 -276
  48. package/cl.muxdata.js +13 -13
  49. package/cl.onboard.js +4 -4
  50. package/cl.persistent.js +11 -11
  51. package/cl.playlist.js +5 -5
  52. package/cl.sessions.js +10 -10
  53. package/cl.simid.js +13 -13
  54. package/cl.smooth.js +59 -59
  55. package/cl.thumbnails.js +19 -19
  56. package/cl.tizen.js +57 -57
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -8
  60. package/cl.vr.js +14 -14
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -0
  63. package/cl.youbora.js +27 -15
  64. package/package.json +3 -1
  65. package/typings.d.ts +123 -24
package/cjs/cl.smooth.js CHANGED
@@ -1,76 +1,76 @@
1
1
  (function(){var g={}; var _ = _ || {}
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){_.Sm()}},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){_.Sm()}},$P=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.Sm()}},aQ=function(a,b){try{a.f.setInt16(a.a,
3
- b,a.h),a.a+=2}catch(c){_.Sm()}},bQ=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},cQ=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){cQ.call(this,a);this.version=b;this.flags=c},dQ=function(a,b,c){cQ.call(this,a);this.h=b;this.offset=c},eQ=function(a,b,c,
4
- d,e){Z.call(this,a,b,c);this.h=d;this.offset=e},fQ=function(a,b,c){cQ.call(this,"ftyp");this.j=a;this.ai=b;this.h=c},gQ=function(){cQ.call(this,_.Qe)},hQ=function(){cQ.call(this,_.og)},iQ=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]},jQ=function(){cQ.call(this,"mvex")},kQ=function(a){Z.call(this,"trex",0,0);this.h=a},lQ=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]},mQ=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},nQ=function(a){Z.call(this,"hdlr",0,0);this.h=a},oQ=function(){Z.call(this,"vmhd",0,1);this.h=new Uint8Array([0,0,0,0,0,0])},pQ=function(a){cQ.call(this,a);this.A=!0},qQ=function(a){pQ.call(this,a);this.height=this.width=0;this.depth=24},rQ=
6
- function(a,b,c,d){pQ.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},sQ=function(a,b){qQ.call(this,"avc1");this.width=a;this.height=b},tQ=function(a,b){sQ.call(this,a,b);this.type="encv"},uQ=function(a,b,c){rQ.call(this,"mp4a",a,b,c)},vQ=function(a,b,c){uQ.call(this,a,b,c);this.type="enca"},wQ=function(a,b){cQ.call(this,"avcC");this.Xa=a;this.ec=b;this.version=1;this.h=this.Xa[0][1];this.j=this.Xa[0][2];this.level=this.Xa[0][3]},xQ=function(a){Z.call(this,"esds",0,0);this.bc=
7
- a},yQ=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},zQ=function(){Z.call(this,"dref",0,0)},AQ=function(){cQ.call(this,_.eg)},BQ=function(){Z.call(this,_.gg,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(){cQ.call(this,"dinf")},IQ=function(){cQ.call(this,_.Pe)},JQ=function(){cQ.call(this,_.Le)},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(){cQ.call(this,"traf")},PQ=function(){cQ.call(this,"moof")},QQ=function(){cQ.call(this,_.Ke);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.Wb=""},TQ=function(a){cQ.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.wh[c];b=b.Pn;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 _.WC([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===_.$c&&(c=["bitrate",VP,"channels","bitsPerSample","samplingRate","fourCC"]);return _.M.la(a,b,c,["id","segmentIndex"])},$Q=function(a,b,c){var d=c.ve.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Xa:null,
11
- ec:null,width:NaN,height:NaN,bc:null,be:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.r:a.Xa=[_.Kj(d[1])];a.ec=[_.Kj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.$c:a.bc=_.Kj(c.ve),a.sampleSize=c.kj||16,a.be=c.be,a.channelCount=c.Og}return a},aR=function(a,b){return a.filter(function(c){return c.type===b})},bR=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)},iR=function(a,b,
12
- c){var d=null;if(cR.test(a)){a=cR.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 dR.test(a)?d=bR(dR,a):eR.test(a)?d=bR(eR,a):fR.test(a)?(a=fR.exec(a),d=Number(a[1])/c.frameRate):gR.test(a)?(a=gR.exec(a),d=Number(a[1])/c.a):hR.test(a)&&(d=bR(hR,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},jR=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))},lR=function(a){this.a=a;this.f=kR(this)},kR=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Rm(b)},mR=function(a,b,c){a:{var d=_.w([_.Pd,_.Nd]);for(var e=d.next();!e.done;e=d.next())if((e=c.Be(e.value))&&e.keyId){d=e.keyId;break a}_.Bh(UP,
14
- "Could not get default Key ID for DRM init data!");d=null}c=new cQ("xxxx");a.type===_.r?c=new tQ(a.width,a.height):c=new vQ(a.channelCount,a.sampleSize,a.be);a=new RQ;a.h=1;a.j=8;a.o=d||"00000000000000000000000000000000";a=(new cQ("schi")).append([a]);b=(new cQ(_.Zf)).append([new TQ(b),new SQ(_.rd,65536),a]);c.append([b]);return c},nR=function(a,b){var c=b.Ee(),d=new iQ(a.timescale,a.duration,a.id),e=(new jQ).append([new kQ(a.id)]),f=new lQ(a.id,a.duration,a.timescale,a.width,a.height),g=new mQ(a.timescale,
15
- a.duration),h=new nQ(a.type),l=null,m=new zQ;m.entries=[new yQ];var n=new BQ;switch(a.type){case _.r:var p=new wQ(a.Xa,a.ec);c?(l=mR(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new sQ(a.width,a.height)).append([p]),n.entries=[l]);l=new oQ;break;case _.$c:p=new xQ(a.bc),c?(l=mR(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new uQ(a.channelCount,a.sampleSize,a.be)).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 hQ).append([f,g]);d=(new gQ).append([d,f,e]);e=new fQ("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Be(_.Nd),f=b.Be(_.Pd),c&&d.append([new dQ("pssh",c.initData,8)]),f&&d.append([new dQ("pssh",f.initData,8)]),c||f||_.Bh(UP,"Could not get PSSH init data!"));c=new lR([e,d]);return _.xj(c.write())},pR=function(a,b){var c,d,e,f,g,h;(new _.cn).M("moof",_.dn).Y("mfhd",function(m){var n=new LQ;n.h=_.W(m.reader);c=n}).M("traf",_.dn).Y("tfhd",function(m){var n=m.reader.Ma();if(null===
17
- m.flags)throw new _.N(_.P,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=_.$m(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.Ma();if(null===m.flags)throw new _.N(_.P,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=_.Zm(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(_.Zm(m.reader)));e=p}).Y("sdtp",function(m){var n=_.bn(m.reader,m.reader.Ma());f=new eQ("sdtp",m.version||0,m.flags||0,
19
- n,0)}).M("uuid",function(m){var n=_.bn(m.reader,16);if(_.Mj(n,oR)){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=_.Xm(m.reader));for(var p=0;p<n.j;p++){var q={Mh:_.bn(m.reader,8),kd:0,ug:[]};if(m.flags&2){q.kd=_.Ym(m.reader);for(var t=0;t<q.kd;t++){var v={Lg:0,Mg:0};v.Lg=_.Ym(m.reader);v.Mg=_.W(m.reader);q.ug.push(v)}}n.h.push(q)}g=n}}).M(_.Ke,function(m){var n=new QQ;0<m.reader.Ma()?n.h=_.bn(m.reader,m.reader.Ma()):(_.Bh(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.Ee()&&g&&l.append([g]);l=(new PQ).append([c,l]);return new lR([l,h])},qR=function(a,b,c,d){var e=d.Ee(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=pR(b,d);if(null===g)return a.request.contentType===_.Q?a.data:g;d=g.get(_.Ke);if(a.request.contentType===_.Q){e=d.h.buffer;if(c){e=_.R.Kd(e);if((e=(new DOMParser).parseFromString(e,_.mg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
21
- e.documentElement;if(h&&(d=new jR(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",_.le],m=0,n=l.length;m<n;m++){b:{var p=f;var q=l[m],t=new RegExp("\\w+:"+q),v=0;if(p.hasAttribute(q))p=p.getAttribute(q);else{q=p.attributes;for(var z=q.length;v<z;v++){var C=q[v].name;if(C=C.match(t)){p=
22
- p.getAttribute(C[0]);break b}}p=null}}f.setAttribute(l[m],iR(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.R.Ya(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].kd);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 lR([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},rR=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},sR=function(a,b,c){a=_.lo(a);c&&a.version!==c&&(a=_.MC(a,c));return{initData:_.KC(a),initDataType:_.rd,keyId:b,periodId:null}},uR=function(){this.w=this.h=this.f=
24
- this.D=null;this.N=1;this.P=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=tR;this.H=0;this.C=this.I=Infinity;this.o=[];this.K=this.ln.bind(this);this.G=new Map},vR=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.Wj(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.D.networkingEngine.fetch(c),_.y(f,d.U,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=_.R.Kd(b);var f=d.parseFromString(e.trim(),_.mg)}catch(AI){throw AI;}if(f&&f.documentElement.tagName===_.ac)var g=f.documentElement;c=g&&0<g.getElementsByTagName("parsererror").length?null:g}catch(AI){}if(!c)throw a.g.error("Unable to parse manifest"),new _.N(_.P,4,4033,a.l);var h=+wR(a,c,"MajorVersion"),
26
- l=+wR(a,c,"MinorVersion"),m=+c.getAttribute("TimeScale")||1E7,n=+wR(a,c,"Duration"),p="TRUE"===c.getAttribute("IsLive"),q=+c.getAttribute("LookAheadCount"),t=+c.getAttribute("DVRWindowLength")||Infinity,v=_.Qn(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(_.P,4,4036,a.l);p?(xR(a,yR),a.A=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),n=Infinity):xR(a,tR);a.a={startTime:0,delay:0,
27
- duration:n/m,Df:t/m,Xd:0};if(v){var z=a.f.playreadyVersion,C=[],F=_.Qn(v,"ProtectionHeader")[0],G=_.Jj(_.Sn(F)||""),A=_.lo(G).a;C.push(rR(_.Pd,{initData:_.KC(_.Xn(A)),initDataType:_.rd,keyId:A,periodId:null},[A]));C.push(rR(_.Nd,sR(G,A,z),[A]));a.o=C}var H=[],O=_.Qn(c,"StreamIndex");if(!O.length)throw a.g.error("No streams found!"),new _.N(_.P,4,4034,a.l);for(var T=0;T<O.length;T++){for(var da,aa=a,wa=O[T],Va=wR(aa,wa,"Type"),eb=+wa.getAttribute("Chunks"),Wa=wa.getAttribute("Subtype"),La=wa.getAttribute("Language")||
28
- _.rg,wb=_.oj(La),Kb=wa.getAttribute("Name")||"",Ag=+wa.getAttribute(_.vb),eo=+wa.getAttribute(_.ub),nV=wR(aa,wa,"Url"),oV=+wa.getAttribute("TimeScale")||null,DI=[],EI=_.Qn(wa,_.Qb),Du=0;Du<EI.length;Du++){var xf=void 0,nc=void 0,Eu=void 0,yf=aa,Ed=EI[Du],Fu=Va,pV=+Ed.getAttribute("Index"),qV=+wR(yf,Ed,"Bitrate"),FI=NaN,GI=NaN,fo=NaN,Gu=NaN,HI=NaN,II=NaN,JI=NaN,KI=Ed.getAttribute("FourCC");switch(Fu){case _.r:FI=+wR(yf,Ed,_.ub);GI=+wR(yf,Ed,_.vb);break;case _.$c:Gu=+Ed.getAttribute("Channels")||2,
29
- fo=+wR(yf,Ed,"SamplingRate"),II=+wR(yf,Ed,"AudioTag"),HI=+wR(yf,Ed,"BitsPerSample"),JI=+wR(yf,Ed,"PacketSize")}var Hu=String(Ed.getAttribute("CodecPrivateData"));if(Fu===_.$c&&!Hu){var LI=Gu,MI={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},go=MI[fo];if("AACH"===KI){nc=new Uint8Array(4);var NI=MI[2*fo];nc[0]=40|go>>1;nc[1]=go<<7|LI<<3|NI>>1;nc[2]=NI<<7|8;nc[3]=0;xf=new Uint16Array(2);xf[0]=(nc[0]<<8)+nc[1];xf[1]=(nc[2]<<8)+nc[3];Eu=xf[0].toString(16)+
30
- xf[1].toString(16)}else nc=new Uint8Array(2),nc[0]=16|go>>1,nc[1]=go<<7|LI<<3,xf=new Uint16Array(1),xf[0]=(nc[0]<<8)+nc[1],Eu=xf[0].toString(16);Hu=Eu.toUpperCase()}var rV={id:yf.P++,type:Fu,index:pV,bitrate:qV,ve:Hu,maxHeight:FI,maxWidth:GI,be:fo,Og:Gu,fo:II,kj:HI,wo:JI,Wk:KI,segmentIndex:null};DI.push(rV)}da=DI;for(var Fe=[],OI=_.Qn(wa,"c"),kk=0;kk<OI.length;kk++){var Iu=OI[kk],ce=parseInt(Iu.getAttribute("t"),10),Wh=parseInt(Iu.getAttribute("d"),10),Ju=parseInt(Iu.getAttribute("r"),10),lk=0;if(isNaN(ce)&&
31
- isNaN(Wh))throw aa.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.N(_.P,4,4037,aa.l);0===kk&&isNaN(ce)&&(lk=ce=0);if(0<kk){var Dg=Fe[Fe.length-1];lk=Dg.n+1;Dg.d||(Dg.d=ce-Dg.t);ce||(ce=Dg.t+Dg.d);Wh||(Wh=ce-Dg.t)}Fe.push({n:lk,d:Wh,t:ce});if(Ju){Ju--;for(var PI=0;PI<Ju;PI++){var ho=Fe[Fe.length-1];lk=ho.n+1;ce=ho.t+ho.d;Wh=ho.d;Fe.push({n:lk,d:Wh,t:ce})}}}aa.yd()||Fe.length===eb||aa.g.warn("Number of fragments ("+eb+") differs from number of chunks ("+
32
- Fe.length+").");H.push({type:Va,ko:eb,An:Wa,language:wb,Wd:La,name:Kb,maxWidth:Ag,maxHeight:eo,Pn:nV,tracks:da,wh:Fe,timescale:oV})}var zf={uo:h,ai:l,timescale:m,duration:n,isLive:p,to:q,Df:t,Mf:!1,streams:H};if(a.h&&a.w)return zR(a,zf),Promise.resolve();a.G.clear();var Ku=zf.timescale,io=zf.duration,tV=aR(zf.streams,_.$c),uV=aR(zf.streams,_.r),vV=aR(zf.streams,_.Q),QI=[],jo=AR(a,io,Ku,tV),ko=AR(a,io,Ku,uV),wV=AR(a,io,Ku,vV);jo.length||(jo=[null]);ko.length||(ko=[null]);for(var Mu=0;Mu<ko.length;Mu++)for(var Nu=
33
- 0;Nu<jo.length;Nu++)QI.push(BR(a,ko[Mu],jo[Nu]));var RI={id:"ID",configurationId:void 0,startTime:0,endTime:io,variants:QI,textStreams:wV,thumbStreams:[]};var yV=zf.streams,Ou=a.a.startTime,SI=a.a.delay,Pu=a.I,TI=Math.min(a.a.duration||Infinity,Pu),Qu=a.yd(),zV=a.a.Df,AV=a.a.Xd,UI=a.H,VI=isFinite(a.C)?a.C:0;if(Qu)TI=Infinity,Ou=Date.now()/1E3-AV,a.a.startTime=Ou,SI=3*UI;else for(var BV=isFinite(Pu)?Pu:a.a.duration,WI=_.w(yV),Ru=WI.next();!Ru.done;Ru=WI.next())for(var XI=_.w(Ru.value.tracks),Su=XI.next();!Su.done;Su=
34
- XI.next()){var YI=Su.value;YI.segmentIndex.offset(-VI);_.tD(YI.segmentIndex,BV)}var ZI=a.f.timeline||{};ZI.type=void 0;a.B=new _.BD(ZI,Ou,SI,!Qu,!0);a.B.f=TI;_.JD(a.B,UI);a.B.A=zV;Qu||a.B.offset(-VI);a.D.filterAllPeriods([RI]);a.h={presentationTimeline:a.B,periods:[RI],minBufferTime:0,cues:[]};Promise.resolve();a.J||(a.D.networkingEngine.Oc(a.K),a.J=!0);a.w=zf;return Promise.resolve()},zR=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=
35
- f.next();!g.done;e={$b:e.$b},g=f.next())if(e.$b=g.value,g=d.tracks.find(function(l){return function(m){return m.type===l.$b.type&&m.bitrate===l.$b.bitrate}}(e))){ZQ(e.$b,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.$b.segmentIndex;g.pa(h);(h=a.a.Df)&&_.ZD(g,_.YD(g)-h).forEach(function(l){l.Va().forEach(function(m){a.G["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.$b.type+" track with bitrate "+
36
- (e.$b.bitrate+". 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 _.XD(n);var p=null;m.type!==_.Q&&(p=ER(a,b,c,m,l));l.segmentIndex=n;var q=_.MJ++,t=Promise.resolve.bind(Promise),v=n.Uc.bind(n),z=n.get.bind(n),C=n.qd.bind(n),F=n.getDuration.bind(n),G=FR[m.type],A="";switch(m.type){case _.r:A=l.ve;var H=/00000001[0-9]7/.exec(A);A="avc1."+(H&&H[0]?A.substr(A.indexOf(H[0])+
37
- 10,6):"42c00c");a.g.debug("VIDEO CODECS: ",A);break;case _.$c:A=l.ve,H=2,"AACH"===l.Wk?H=5:A&&(H=(parseInt(A.substr(0,2),16)&248)>>3),A="mp4a.40."+H,a.g.debug("AUDIO CODECS: ",A)}H=m.type===_.Q?GR[m.An]:void 0;return{id:q,originalId:null,yo:null,createSegmentIndex:t,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:C,getDuration:F,segmentIndex:n,segmentLookupStrategy:_.sC,initSegmentReference:p,mimeType:G,codecs:A,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||
38
- void 0,kind:H,encrypted:a.Nf(),keyId:null,language:m.language,originalLanguage:m.Wd,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.Og||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.wh.forEach(function(h,l){var m=h.d/g;if(0===l){var n=h.t/g;a.C=Math.min(a.C,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 _.mj(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===_.$c)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Xd?a.a.Xd=b.endTime:a.a.Xd=Math.min(a.a.Xd,b.endTime);return f},ER=function(a,b,c,d,e){b=$Q(b,d.timescale||c,e);c={isLive:a.yd.bind(a),Ee:a.Nf.bind(a),dl:function(){return 1},Be:a.zh.bind(a)};d=new Uint8Array(0);try{d=nR(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.N(_.P,3,4035,g);}var f="data:text/plain;base64,"+_.Ij(d);return new _.YC(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:_.rg;return c||b?{id:a.N++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},wR=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.N(_.P,4,4038,a.l,c);},HR=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Ub.bind(a),b))},xR=function(a,b){var c=b===tR;a.h&&a.h.presentationTimeline&&
41
- _.ED(a.h.presentationTimeline,c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.L=b},IR=function(){};cQ.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};cQ.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
- cQ.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
- cQ.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);_.Tm(a,bQ(this.type));this.size>b&&WP(a,this.size);"uuid"===this.type&&_.Tm(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,cQ);Z.prototype.a=function(){return 4+cQ.prototype.a.call(this)};Z.prototype.write=function(a){cQ.prototype.write.call(this,a);XP(a,this.version);YP(a,this.flags)};
44
- _.x(dQ,cQ);dQ.prototype.a=function(){return this.h.byteLength+cQ.prototype.a.call(this)-this.offset};dQ.prototype.write=function(a){cQ.prototype.write.call(this,a);_.Tm(a,this.h,this.offset);a.getPosition()};_.x(eQ,Z);eQ.prototype.a=function(){return this.h.byteLength+Z.prototype.a.call(this)-this.offset};eQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.Tm(a,this.h,this.offset);a.getPosition()};_.x(fQ,cQ);
45
- fQ.prototype.a=function(){var a=this.j.length;a=a+4+this.h.join("").length;return a+cQ.prototype.a.call(this)};fQ.prototype.write=function(a){cQ.prototype.write.call(this,a);_.Tm(a,bQ(this.j));_.V(a,this.ai);_.Tm(a,bQ(this.h.join("")));a.getPosition()};_.x(gQ,cQ);_.x(hQ,cQ);_.x(iQ,Z);iQ.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
- iQ.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(jQ,cQ);_.x(kQ,Z);kQ.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
- kQ.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(lQ,Z);lQ.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
- lQ.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(mQ,Z);mQ.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
49
- mQ.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(nQ,Z);nQ.prototype.a=function(){return 33+Z.prototype.a.call(this)};
50
- nQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);this.h===_.r?_.Tm(a,bQ("vide")):_.Tm(a,bQ("soun"));_.V(a,0);_.V(a,0);_.V(a,0);this.h===_.r?_.Tm(a,bQ("VideoHandler\x00")):_.Tm(a,bQ("SoundHandler\x00"));a.getPosition()};_.x(oQ,Z);oQ.prototype.a=function(){return 2+this.h.byteLength+Z.prototype.a.call(this)};oQ.prototype.write=function(a){Z.prototype.write.call(this,a);ZP(a,0);_.Tm(a,this.h);a.getPosition()};_.x(pQ,cQ);pQ.prototype.a=function(){return 8+cQ.prototype.a.call(this)};
51
- pQ.prototype.write=function(a){cQ.prototype.write.call(this,a);_.V(a,0);ZP(a,0);ZP(a,1)};_.x(qQ,pQ);qQ.prototype.a=function(){return 70+pQ.prototype.a.call(this)};qQ.prototype.write=function(a){pQ.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);_.Tm(a,bQ("AVC Coding",31));ZP(a,this.depth);aQ(a,-1)};_.x(rQ,pQ);rQ.prototype.a=function(){return 20+pQ.prototype.a.call(this)};
52
- rQ.prototype.write=function(a){pQ.prototype.write.call(this,a);_.V(a,0);_.V(a,0);ZP(a,this.channelCount);ZP(a,this.sampleSize);aQ(a,0);ZP(a,0);ZP(a,this.sampleRate);ZP(a,0)};_.x(sQ,qQ);sQ.prototype.write=function(a){qQ.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.x(tQ,sQ);_.x(uQ,rQ);uQ.prototype.write=function(a){rQ.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.x(vQ,uQ);_.x(wQ,cQ);
53
- wQ.prototype.a=function(){for(var a=7,b=0;b<this.Xa.length;b++)a+=2,a+=this.Xa[b].byteLength;for(b=0;b<this.Xa.length;b++)a+=2,a+=this.ec[b].byteLength;return a+cQ.prototype.a.call(this)};
54
- wQ.prototype.write=function(a){cQ.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.Xa.length);for(var b=0;b<this.Xa.length;b++)ZP(a,this.Xa[b].length),_.Tm(a,this.Xa[b]);XP(a,this.ec.length);for(b=0;b<this.ec.length;b++)ZP(a,this.ec[b].length),_.Tm(a,this.ec[b]);a.getPosition()};_.x(xQ,Z);xQ.prototype.a=function(){return 22+(this.bc.byteLength+3)+Z.prototype.a.call(this)};
55
- xQ.prototype.write=function(a){Z.prototype.write.call(this,a);XP(a,3);XP(a,23+this.bc.byteLength);ZP(a,1);XP(a,0);XP(a,4);XP(a,15+this.bc.byteLength);XP(a,64);XP(a,21);YP(a,0);_.V(a,0);_.V(a,0);XP(a,5);XP(a,this.bc.byteLength);_.Tm(a,this.bc);_.Tm(a,new Uint8Array([6,1,2]));a.getPosition()};_.x(yQ,Z);yQ.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};yQ.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.Tm(a,bQ(this.location));a.getPosition()};
56
- _.x(zQ,Z);zQ.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)};zQ.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,cQ);_.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);aQ(a,0);ZP(a,0);a.getPosition()};
60
- _.x(HQ,cQ);_.x(IQ,cQ);_.x(JQ,cQ);_.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(),$P(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]):$P(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,cQ);_.x(PQ,cQ);_.x(QQ,cQ);
64
- QQ.prototype.a=function(){return this.h.byteLength+cQ.prototype.a.call(this)};QQ.prototype.write=function(a){cQ.prototype.write.call(this,a);0<this.h.byteLength&&_.Tm(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);_.Tm(a,_.Kj(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+=bQ(this.Wb).byteLength);return a+Z.prototype.a.call(this)};SQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.Tm(a,bQ(this.h));_.V(a,this.j);this.flags&1&&_.Tm(a,bQ(this.Wb));a.getPosition()};
66
- _.x(TQ,cQ);TQ.prototype.a=function(){return bQ(this.h).byteLength+cQ.prototype.a.call(this)};TQ.prototype.write=function(a){cQ.prototype.write.call(this,a);_.Tm(a,bQ(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].Mh.byteLength,this.flags&2){a+=2;for(var c=0;c<this.h[b].kd;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(_.Tm(a,this.h[b].Mh),this.flags&2){ZP(a,this.h[b].kd);for(var c=0;c<this.h[b].kd;c++)ZP(a,this.h[b].ug[c].Lg),_.V(a,this.h[b].ug[c].Mg)}a.getPosition()};var cR=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,dR=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,eR=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,fR=/^(\d*\.?\d*)f$/,gR=/^(\d*\.?\d*)t$/,hR=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;lR.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};lR.prototype.write=function(){this.f=kR(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var oR=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.u=uR.prototype;_.u.configure=function(a){this.f=a};_.u.start=function(a,b){var c=this;this.D=b;var d=_.Zg(new Set([a,XQ(a)])).concat();return vR(this,d).then(function(e){return CR(c,e.data).then(function(){HR(c,c.A);return c.h})})};_.u.requestStop=function(){};_.u.stop=function(){this.D&&this.D.networkingEngine.ae(this.K);this.A=this.w=this.h=this.f=this.D=null;this.j&&(clearTimeout(this.j),this.j=null);this.J=!1;this.I=this.C=Infinity;return Promise.resolve()};
70
- _.u.update=function(){var a=this;if(this.yd())return vR(this,[this.l]).then(function(b){return CR(a,b.data).then(function(){return a.h})})["catch"](function(b){if(a.D)a.D.onError(b)})};_.u.setCurrentVariant=function(){};_.u.Ub=function(){var a=this;this.g.debug(_.kC);this.D&&(this.j=null,this.update().then(function(){HR(a,a.A)})["catch"](function(b){a.D&&(a.D.onError(b),1===b.severity&&HR(a,100))}))};_.u.yd=function(){return this.L===yR};_.u.Nf=function(){return 0<this.o.length};
71
- _.u.zh=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
- _.u.ln=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.yd.bind(this),Ee:this.Nf.bind(this),dl:function(){return 1},Be:this.zh.bind(this)},d=!1,e=new _.N(_.P,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=qR(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:_.Fg,audio:_.dd,text:_.Xc},tR=_.kc,yR="LIVE",GR={Rn:_.nd,Yn:_.ig};_.x(IR,_.it);IR.prototype.f=function(){_.hu.ism=uR;_.fu[_.Yc]=uR};IR.prototype.a=function(){_.AE("ism");_.BE(_.Yc)};IR.prototype.id=function(){return _.$f};_.J("clpp.smooth.SmoothComponent",IR);};
2
+ var f=function(window){var DQ="Full MP4 box must have flags defined",EQ="clpp.smooth.SmoothMP4Processor",FQ="codecPrivateData",GQ=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)},HQ=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Wm()}},IQ=function(a,b){HQ(a,b>>16&255);HQ(a,b>>8&255);HQ(a,b&255)},JQ=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.Wm()}},KQ=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.Wm()}},LQ=function(a,b){try{a.f.setInt16(a.a,
3
+ b,a.h),a.a+=2}catch(c){_.Wm()}},MQ=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},NQ=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){NQ.call(this,a);this.version=b;this.flags=c},OQ=function(a,b,c){NQ.call(this,a);this.h=b;this.offset=c},PQ=function(a,b,c,
4
+ d,e){Z.call(this,a,b,c);this.h=d;this.offset=e},QQ=function(a,b,c){NQ.call(this,"ftyp");this.j=a;this.ei=b;this.h=c},RQ=function(){NQ.call(this,_.Qe)},SQ=function(){NQ.call(this,_.og)},TQ=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]},UQ=function(){NQ.call(this,"mvex")},VQ=function(a){Z.call(this,"trex",0,0);this.h=a},WQ=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]},XQ=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},YQ=function(a){Z.call(this,"hdlr",0,0);this.h=a},ZQ=function(){Z.call(this,"vmhd",0,1);this.h=new Uint8Array([0,0,0,0,0,0])},$Q=function(a){NQ.call(this,a);this.A=!0},aR=function(a){$Q.call(this,a);this.height=this.width=0;this.depth=24},bR=
6
+ function(a,b,c,d){$Q.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},cR=function(a,b){aR.call(this,"avc1");this.width=a;this.height=b},dR=function(a,b){cR.call(this,a,b);this.type="encv"},eR=function(a,b,c){bR.call(this,"mp4a",a,b,c)},fR=function(a,b,c){eR.call(this,a,b,c);this.type="enca"},gR=function(a,b){NQ.call(this,"avcC");this.Za=a;this.fc=b;this.version=1;this.h=this.Za[0][1];this.j=this.Za[0][2];this.level=this.Za[0][3]},hR=function(a){Z.call(this,"esds",0,0);this.cc=
7
+ a},iR=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},jR=function(){Z.call(this,"dref",0,0)},kR=function(){NQ.call(this,_.eg)},lR=function(){Z.call(this,_.gg,0,0)},mR=function(){Z.call(this,"stts",0,0)},nR=function(){Z.call(this,"stsc",0,0)},oR=function(){Z.call(this,"stco",0,0)},pR=function(){Z.call(this,"stsz",0,0)},qR=function(){Z.call(this,"smhd",0,0)},rR=function(){NQ.call(this,"dinf")},sR=function(){NQ.call(this,_.Pe)},tR=function(){NQ.call(this,_.Le)},uR=function(a,b){Z.call(this,
8
+ "tfdt",a,0);this.baseMediaDecodeTime=b},vR=function(){Z.call(this,"mfhd",0,0);this.h=0},wR=function(a,b){Z.call(this,"trun",a,b);this.o=this.l=this.h=0;this.w=[];this.sampleSize=[];this.B=[];this.j=[]},xR=function(a,b){Z.call(this,"tfhd",a,b);this.h=255;this.o=this.w=this.l=this.B=this.j=0},yR=function(){NQ.call(this,"traf")},zR=function(){NQ.call(this,"moof")},AR=function(){NQ.call(this,_.Je);this.h=new Uint8Array(0)},BR=function(){Z.call(this,"tenc",0,0);this.h=1;this.j=8;this.o="";this.l=[]},CR=
9
+ function(a,b){Z.call(this,"schm",0,0);this.h=a;this.j=b;this.Xb=""},DR=function(a){NQ.call(this,"frma");this.h=a},ER=function(){Z.call(this,"saio",0,0);this.offset=[0]},FR=function(a,b,c){Z.call(this,"saiz",0,0);this.h=a;this.l=b;this.j=c},GR=function(a,b){Z.call(this,"senc",a,b);this.j=0;this.l=8;this.h=[]},HR=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},IR=function(a,b,c,d){c=b.Ah[c];b=b.Sn;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 _.ED([a],[b])[0]},JR=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.r?c=["maxWidth","maxHeight","bitrate",FQ,"fourCC"]:a.type===_.$c&&(c=["bitrate",FQ,"channels","bitsPerSample","samplingRate","fourCC"]);return _.M.ma(a,b,c,["id","segmentIndex"])},KR=function(a,b,c){var d=c.ve.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Za:null,
11
+ fc:null,width:NaN,height:NaN,cc:null,be:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.r:a.Za=[_.Mj(d[1])];a.fc=[_.Mj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.$c:a.cc=_.Mj(c.ve),a.sampleSize=c.nj||16,a.be=c.be,a.channelCount=c.Sg}return a},LR=function(a,b){return a.filter(function(c){return c.type===b})},MR=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)},TR=function(a,b,
12
+ c){var d=null;if(NR.test(a)){a=NR.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 OR.test(a)?d=MR(OR,a):PR.test(a)?d=MR(PR,a):QR.test(a)?(a=QR.exec(a),d=Number(a[1])/c.frameRate):RR.test(a)?(a=RR.exec(a),d=Number(a[1])/c.a):SR.test(a)&&(d=MR(SR,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},UR=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))},WR=function(a){this.a=a;this.f=VR(this)},VR=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Vm(b)},YR=function(a,b,c){a:{var d=_.w([_.Pd,_.Nd]);for(var e=d.next();!e.done;e=d.next())if((e=c.Be(e.value))&&e.keyId){d=e.keyId;break a}_.Dh(EQ,
14
+ "Could not get default Key ID for DRM init data!");d=null}c=new NQ("xxxx");a.type===_.r?c=new dR(a.width,a.height):c=new fR(a.channelCount,a.sampleSize,a.be);a=new BR;a.h=1;a.j=8;a.o=d||"00000000000000000000000000000000";a=(new NQ("schi")).append([a]);b=(new NQ(_.Zf)).append([new DR(b),new CR(_.rd,65536),a]);c.append([b]);return c},ZR=function(a,b){var c=b.Ee(),d=new TQ(a.timescale,a.duration,a.id),e=(new UQ).append([new VQ(a.id)]),f=new WQ(a.id,a.duration,a.timescale,a.width,a.height),g=new XQ(a.timescale,
15
+ a.duration),h=new YQ(a.type),l=null,m=new jR;m.entries=[new iR];var n=new lR;switch(a.type){case _.r:var p=new gR(a.Za,a.fc);c?(l=YR(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new cR(a.width,a.height)).append([p]),n.entries=[l]);l=new ZQ;break;case _.$c:p=new hR(a.cc),c?(l=YR(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new eR(a.channelCount,a.sampleSize,a.be)).append([p]),n.entries=[l]),l=new qR}n=(new kR).append([n,new mR,new nR,new pR,new oR]);m=(new rR).append([m]);m=(new sR).append([l,m,n]);
16
+ g=(new tR).append([g,h,m]);f=(new SQ).append([f,g]);d=(new RQ).append([d,f,e]);e=new QQ("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Be(_.Nd),f=b.Be(_.Pd),c&&d.append([new OQ("pssh",c.initData,8)]),f&&d.append([new OQ("pssh",f.initData,8)]),c||f||_.Dh(EQ,"Could not get PSSH init data!"));c=new WR([e,d]);return _.zj(c.write())},aS=function(a,b){var c,d,e,f,g,h;(new _.gn).M("moof",_.hn).Y("mfhd",function(m){var n=new vR;n.h=_.W(m.reader);c=n}).M("traf",_.hn).Y("tfhd",function(m){var n=m.reader.Oa();if(null===
17
+ m.flags)throw new _.N(_.P,3,3019,DQ);var p=new xR(m.version||0,m.flags||0);p.h=_.W(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.dn(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.Oa();if(null===m.flags)throw new _.N(_.P,3,3019,DQ);var p=new wR(m.version||
18
+ 0,m.flags||0);p.h=_.W(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.l=_.cn(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(_.cn(m.reader)));e=p}).Y("sdtp",function(m){var n=_.fn(m.reader,m.reader.Oa());f=new PQ("sdtp",m.version||0,m.flags||0,
19
+ n,0)}).M("uuid",function(m){var n=_.fn(m.reader,16);if(_.Oj(n,$R)){n=_.W(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new GR(m.version,m.flags);n.j=_.W(m.reader);m.flags&1&&(n.l=_.an(m.reader));for(var p=0;p<n.j;p++){var q={Rh:_.fn(m.reader,8),kd:0,wg:[]};if(m.flags&2){q.kd=_.bn(m.reader);for(var t=0;t<q.kd;t++){var v={Pg:0,Qg:0};v.Pg=_.bn(m.reader);v.Qg=_.W(m.reader);q.wg.push(v)}}n.h.push(q)}g=n}}).M(_.Je,function(m){var n=new AR;0<m.reader.Oa()?n.h=_.fn(m.reader,m.reader.Oa()):(_.Dh(EQ,"mdat box is empty!"),
20
+ n.h=new Uint8Array(0));h=n}).parse(a,!1);if(!h)return null;var l=(new yR).append([d,e]);f&&l.append([f]);b.Ee()&&g&&l.append([g]);l=(new zR).append([c,l]);return new WR([l,h])},bS=function(a,b,c,d){var e=d.Ee(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=aS(b,d);if(null===g)return a.request.contentType===_.Q?a.data:g;d=g.get(_.Je);if(a.request.contentType===_.Q){e=d.h.buffer;if(c){e=_.R.Kd(e);if((e=(new DOMParser).parseFromString(e,_.mg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
21
+ e.documentElement;if(h&&(d=new UR(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",_.le],m=0,n=l.length;m<n;m++){b:{var p=f;var q=l[m],t=new RegExp("\\w+:"+q),v=0;if(p.hasAttribute(q))p=p.getAttribute(q);else{q=p.attributes;for(var z=q.length;v<z;v++){var C=q[v].name;if(C=C.match(t)){p=
22
+ p.getAttribute(C[0]);break b}}p=null}}f.setAttribute(l[m],TR(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.R.$a(e).buffer}else c=e;return c}h=new zR;a=g.get("mfhd");b=new yR;l=g.get("tfhd");m=new uR(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].kd);else g=8;b.append([c,new ER,new FR(g,l,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=
23
+ new WR([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},cS=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},dS=function(a,b,c){a=_.io(a);c&&a.version!==c&&(a=_.uD(a,c));return{initData:_.sD(a),initDataType:_.rd,keyId:b,periodId:null}},fS=function(){this.w=this.h=this.f=
24
+ this.D=null;this.N=1;this.P=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=eS;this.H=0;this.C=this.I=Infinity;this.o=[];this.K=this.pn.bind(this);this.G=new Map},gS=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.Yj(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.D.networkingEngine.fetch(c),_.y(f,d.U,2);e=f.f;a.l=e.uri;return f["return"](e)})},nS=function(a,b){var c=null;try{var d=new DOMParser;try{var e=_.R.Kd(b);var f=d.parseFromString(e.trim(),_.mg)}catch(aJ){throw aJ;}if(f&&f.documentElement.tagName===_.ac)var g=f.documentElement;c=g&&0<g.getElementsByTagName("parsererror").length?null:g}catch(aJ){}if(!c)throw a.g.error("Unable to parse manifest"),new _.N(_.P,4,4033,a.l);var h=+hS(a,c,"MajorVersion"),
26
+ l=+hS(a,c,"MinorVersion"),m=+c.getAttribute("TimeScale")||1E7,n=+hS(a,c,"Duration"),p="TRUE"===c.getAttribute("IsLive"),q=+c.getAttribute("LookAheadCount"),t=+c.getAttribute("DVRWindowLength")||Infinity,v=_.Un(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(_.P,4,4036,a.l);p?(iS(a,jS),a.A=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),n=Infinity):iS(a,eS);a.a={startTime:0,delay:0,
27
+ duration:n/m,Df:t/m,Xd:0};if(v){var z=a.f.playreadyVersion,C=[],F=_.Un(v,"ProtectionHeader")[0],G=_.Lj(_.Wn(F)||""),B=_.io(G).a;C.push(cS(_.Pd,{initData:_.sD(_.ao(B)),initDataType:_.rd,keyId:B,periodId:null},[B]));C.push(cS(_.Nd,dS(G,B,z),[B]));a.o=C}var H=[],O=_.Un(c,"StreamIndex");if(!O.length)throw a.g.error("No streams found!"),new _.N(_.P,4,4034,a.l);for(var T=0;T<O.length;T++){for(var da,aa=a,ya=O[T],Va=hS(aa,ya,"Type"),fb=+ya.getAttribute("Chunks"),Wa=ya.getAttribute("Subtype"),La=ya.getAttribute("Language")||
28
+ _.rg,vb=_.qj(La),Jb=ya.getAttribute("Name")||"",Cg=+ya.getAttribute(_.wb),lo=+ya.getAttribute(_.ub),YV=hS(aa,ya,"Url"),ZV=+ya.getAttribute("TimeScale")||null,dJ=[],eJ=_.Un(ya,_.Qb),Lu=0;Lu<eJ.length;Lu++){var Cf=void 0,qc=void 0,Mu=void 0,Df=aa,Jd=eJ[Lu],Nu=Va,$V=+Jd.getAttribute("Index"),aW=+hS(Df,Jd,"Bitrate"),fJ=NaN,gJ=NaN,mo=NaN,Ou=NaN,hJ=NaN,iJ=NaN,jJ=NaN,kJ=Jd.getAttribute("FourCC");switch(Nu){case _.r:fJ=+hS(Df,Jd,_.ub);gJ=+hS(Df,Jd,_.wb);break;case _.$c:Ou=+Jd.getAttribute("Channels")||2,
29
+ mo=+hS(Df,Jd,"SamplingRate"),iJ=+hS(Df,Jd,"AudioTag"),hJ=+hS(Df,Jd,"BitsPerSample"),jJ=+hS(Df,Jd,"PacketSize")}var Pu=String(Jd.getAttribute("CodecPrivateData"));if(Nu===_.$c&&!Pu){var lJ=Ou,mJ={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},no=mJ[mo];if("AACH"===kJ){qc=new Uint8Array(4);var nJ=mJ[2*mo];qc[0]=40|no>>1;qc[1]=no<<7|lJ<<3|nJ>>1;qc[2]=nJ<<7|8;qc[3]=0;Cf=new Uint16Array(2);Cf[0]=(qc[0]<<8)+qc[1];Cf[1]=(qc[2]<<8)+qc[3];Mu=Cf[0].toString(16)+
30
+ Cf[1].toString(16)}else qc=new Uint8Array(2),qc[0]=16|no>>1,qc[1]=no<<7|lJ<<3,Cf=new Uint16Array(1),Cf[0]=(qc[0]<<8)+qc[1],Mu=Cf[0].toString(16);Pu=Mu.toUpperCase()}var bW={id:Df.P++,type:Nu,index:$V,bitrate:aW,ve:Pu,maxHeight:fJ,maxWidth:gJ,be:mo,Sg:Ou,jo:iJ,nj:hJ,Ao:jJ,Zk:kJ,segmentIndex:null};dJ.push(bW)}da=dJ;for(var Ke=[],oJ=_.Un(ya,"c"),mk=0;mk<oJ.length;mk++){var Qu=oJ[mk],ie=parseInt(Qu.getAttribute("t"),10),Zh=parseInt(Qu.getAttribute("d"),10),Ru=parseInt(Qu.getAttribute("r"),10),nk=0;if(isNaN(ie)&&
31
+ isNaN(Zh))throw aa.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.N(_.P,4,4037,aa.l);0===mk&&isNaN(ie)&&(nk=ie=0);if(0<mk){var Fg=Ke[Ke.length-1];nk=Fg.n+1;Fg.d||(Fg.d=ie-Fg.t);ie||(ie=Fg.t+Fg.d);Zh||(Zh=ie-Fg.t)}Ke.push({n:nk,d:Zh,t:ie});if(Ru){Ru--;for(var pJ=0;pJ<Ru;pJ++){var oo=Ke[Ke.length-1];nk=oo.n+1;ie=oo.t+oo.d;Zh=oo.d;Ke.push({n:nk,d:Zh,t:ie})}}}aa.yd()||Ke.length===fb||aa.g.warn("Number of fragments ("+fb+") differs from number of chunks ("+
32
+ Ke.length+").");H.push({type:Va,oo:fb,Dn:Wa,language:vb,Wd:La,name:Jb,maxWidth:Cg,maxHeight:lo,Sn:YV,tracks:da,Ah:Ke,timescale:ZV})}var Ef={yo:h,ei:l,timescale:m,duration:n,isLive:p,xo:q,Df:t,Mf:!1,streams:H};if(a.h&&a.w)return kS(a,Ef),Promise.resolve();a.G.clear();var Su=Ef.timescale,po=Ef.duration,dW=LR(Ef.streams,_.$c),eW=LR(Ef.streams,_.r),fW=LR(Ef.streams,_.Q),qJ=[],qo=lS(a,po,Su,dW),ro=lS(a,po,Su,eW),gW=lS(a,po,Su,fW);qo.length||(qo=[null]);ro.length||(ro=[null]);for(var Uu=0;Uu<ro.length;Uu++)for(var Vu=
33
+ 0;Vu<qo.length;Vu++)qJ.push(mS(a,ro[Uu],qo[Vu]));var rJ={id:"ID",configurationId:void 0,startTime:0,endTime:po,variants:qJ,textStreams:gW,thumbStreams:[]};var iW=Ef.streams,Wu=a.a.startTime,sJ=a.a.delay,Xu=a.I,tJ=Math.min(a.a.duration||Infinity,Xu),Yu=a.yd(),jW=a.a.Df,kW=a.a.Xd,uJ=a.H,vJ=isFinite(a.C)?a.C:0;if(Yu)tJ=Infinity,Wu=Date.now()/1E3-kW,a.a.startTime=Wu,sJ=3*uJ;else for(var lW=isFinite(Xu)?Xu:a.a.duration,wJ=_.w(iW),Zu=wJ.next();!Zu.done;Zu=wJ.next())for(var xJ=_.w(Zu.value.tracks),$u=xJ.next();!$u.done;$u=
34
+ xJ.next()){var yJ=$u.value;yJ.segmentIndex.offset(-vJ);_.bE(yJ.segmentIndex,lW)}var zJ=a.f.timeline||{};zJ.type=void 0;a.B=new _.jE(zJ,Wu,sJ,!Yu,!0);a.B.f=tJ;_.rE(a.B,uJ);a.B.A=jW;Yu||a.B.offset(-vJ);a.D.filterAllPeriods([rJ]);a.h={presentationTimeline:a.B,periods:[rJ],minBufferTime:0,cues:[]};Promise.resolve();a.J||(a.D.networkingEngine.Oc(a.K),a.J=!0);a.w=Ef;return Promise.resolve()},kS=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=
35
+ f.next();!g.done;e={ac:e.ac},g=f.next())if(e.ac=g.value,g=d.tracks.find(function(l){return function(m){return m.type===l.ac.type&&m.bitrate===l.ac.bitrate}}(e))){JR(e.ac,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=oS(a,a.w.timescale,d,g);g=e.ac.segmentIndex;g.pa(h);(h=a.a.Df)&&_.HE(g,_.GE(g)-h).forEach(function(l){l.Xa().forEach(function(m){a.G["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.ac.type+" track with bitrate "+
36
+ (e.ac.bitrate+". Skipping update."))},lS=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=oS(a,c,m,l);n=new _.FE(n);var p=null;m.type!==_.Q&&(p=pS(a,b,c,m,l));l.segmentIndex=n;var q=_.uK++,t=Promise.resolve.bind(Promise),v=n.Uc.bind(n),z=n.get.bind(n),C=n.qd.bind(n),F=n.getDuration.bind(n),G=qS[m.type],B="";switch(m.type){case _.r:B=l.ve;var H=/00000001[0-9]7/.exec(B);B="avc1."+(H&&H[0]?B.substr(B.indexOf(H[0])+
37
+ 10,6):"42c00c");a.g.debug("VIDEO CODECS: ",B);break;case _.$c:B=l.ve,H=2,"AACH"===l.Zk?H=5:B&&(H=(parseInt(B.substr(0,2),16)&248)>>3),B="mp4a.40."+H,a.g.debug("AUDIO CODECS: ",B)}H=m.type===_.Q?rS[m.Dn]:void 0;return{id:q,originalId:null,Co:null,createSegmentIndex:t,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:C,getDuration:F,segmentIndex:n,segmentLookupStrategy:_.aD,initSegmentReference:p,mimeType:G,codecs:B,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||
38
+ void 0,kind:H,encrypted:a.Of(),keyId:null,language:m.language,originalLanguage:m.Wd,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.Sg||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},oS=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.Ah.forEach(function(h,l){var m=h.d/g;if(0===l){var n=h.t/g;a.C=Math.min(a.C,n)}else n=f[l-1].endTime;var p=n+m,q=IR(a.l,c,l,d);a.H=Math.max(a.H,m);f.push(new _.oj(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===_.$c)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Xd?a.a.Xd=b.endTime:a.a.Xd=Math.min(a.a.Xd,b.endTime);return f},pS=function(a,b,c,d,e){b=KR(b,d.timescale||c,e);c={isLive:a.yd.bind(a),Ee:a.Of.bind(a),gl:function(){return 1},Be:a.Dh.bind(a)};d=new Uint8Array(0);try{d=ZR(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.N(_.P,3,4035,g);}var f="data:text/plain;base64,"+_.Kj(d);return new _.GD(function(){return[f]},
40
+ 0,null,null,!0)},mS=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.rg;return c||b?{id:a.N++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},hS=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.N(_.P,4,4038,a.l,c);},sS=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Vb.bind(a),b))},iS=function(a,b){var c=b===eS;a.h&&a.h.presentationTimeline&&
41
+ _.mE(a.h.presentationTimeline,c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.L=b},tS=function(){};NQ.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};NQ.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
+ NQ.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
+ NQ.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);_.Xm(a,MQ(this.type));this.size>b&&GQ(a,this.size);"uuid"===this.type&&_.Xm(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,NQ);Z.prototype.a=function(){return 4+NQ.prototype.a.call(this)};Z.prototype.write=function(a){NQ.prototype.write.call(this,a);HQ(a,this.version);IQ(a,this.flags)};
44
+ _.x(OQ,NQ);OQ.prototype.a=function(){return this.h.byteLength+NQ.prototype.a.call(this)-this.offset};OQ.prototype.write=function(a){NQ.prototype.write.call(this,a);_.Xm(a,this.h,this.offset);a.getPosition()};_.x(PQ,Z);PQ.prototype.a=function(){return this.h.byteLength+Z.prototype.a.call(this)-this.offset};PQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.Xm(a,this.h,this.offset);a.getPosition()};_.x(QQ,NQ);
45
+ QQ.prototype.a=function(){var a=this.j.length;a=a+4+this.h.join("").length;return a+NQ.prototype.a.call(this)};QQ.prototype.write=function(a){NQ.prototype.write.call(this,a);_.Xm(a,MQ(this.j));_.V(a,this.ei);_.Xm(a,MQ(this.h.join("")));a.getPosition()};_.x(RQ,NQ);_.x(SQ,NQ);_.x(TQ,Z);TQ.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
+ TQ.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(GQ(a,0),GQ(a,0),_.V(a,this.timescale),GQ(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));_.V(a,65536);JQ(a,this.volume);JQ(a,0);_.V(a,0);_.V(a,0);for(var b=0;b<this.h.length;b++)HQ(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(UQ,NQ);_.x(VQ,Z);VQ.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
+ VQ.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(WQ,Z);WQ.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
+ WQ.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(GQ(a,0),GQ(a,0),_.V(a,this.j),_.V(a,0),GQ(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);JQ(a,0);JQ(a,0);JQ(a,this.volume);JQ(a,0);for(var b=0;b<this.h.length;b++)HQ(a,this.h[b]);JQ(a,this.width);JQ(a,0);JQ(a,this.height);JQ(a,0);a.getPosition()};_.x(XQ,Z);XQ.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
49
+ XQ.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(GQ(a,0),GQ(a,0),_.V(a,this.timescale),GQ(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));JQ(a,this.language);JQ(a,0);a.getPosition()};_.x(YQ,Z);YQ.prototype.a=function(){return 33+Z.prototype.a.call(this)};
50
+ YQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);this.h===_.r?_.Xm(a,MQ("vide")):_.Xm(a,MQ("soun"));_.V(a,0);_.V(a,0);_.V(a,0);this.h===_.r?_.Xm(a,MQ("VideoHandler\x00")):_.Xm(a,MQ("SoundHandler\x00"));a.getPosition()};_.x(ZQ,Z);ZQ.prototype.a=function(){return 2+this.h.byteLength+Z.prototype.a.call(this)};ZQ.prototype.write=function(a){Z.prototype.write.call(this,a);JQ(a,0);_.Xm(a,this.h);a.getPosition()};_.x($Q,NQ);$Q.prototype.a=function(){return 8+NQ.prototype.a.call(this)};
51
+ $Q.prototype.write=function(a){NQ.prototype.write.call(this,a);_.V(a,0);JQ(a,0);JQ(a,1)};_.x(aR,$Q);aR.prototype.a=function(){return 70+$Q.prototype.a.call(this)};aR.prototype.write=function(a){$Q.prototype.write.call(this,a);JQ(a,0);JQ(a,0);_.V(a,0);_.V(a,0);_.V(a,0);JQ(a,this.width);JQ(a,this.height);_.V(a,4718592);_.V(a,4718592);_.V(a,0);JQ(a,1);HQ(a,10);_.Xm(a,MQ("AVC Coding",31));JQ(a,this.depth);LQ(a,-1)};_.x(bR,$Q);bR.prototype.a=function(){return 20+$Q.prototype.a.call(this)};
52
+ bR.prototype.write=function(a){$Q.prototype.write.call(this,a);_.V(a,0);_.V(a,0);JQ(a,this.channelCount);JQ(a,this.sampleSize);LQ(a,0);JQ(a,0);JQ(a,this.sampleRate);JQ(a,0)};_.x(cR,aR);cR.prototype.write=function(a){aR.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.x(dR,cR);_.x(eR,bR);eR.prototype.write=function(a){bR.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.x(fR,eR);_.x(gR,NQ);
53
+ gR.prototype.a=function(){for(var a=7,b=0;b<this.Za.length;b++)a+=2,a+=this.Za[b].byteLength;for(b=0;b<this.Za.length;b++)a+=2,a+=this.fc[b].byteLength;return a+NQ.prototype.a.call(this)};
54
+ gR.prototype.write=function(a){NQ.prototype.write.call(this,a);HQ(a,this.version);HQ(a,this.h);HQ(a,this.j);HQ(a,this.level);HQ(a,255);HQ(a,224|this.Za.length);for(var b=0;b<this.Za.length;b++)JQ(a,this.Za[b].length),_.Xm(a,this.Za[b]);HQ(a,this.fc.length);for(b=0;b<this.fc.length;b++)JQ(a,this.fc[b].length),_.Xm(a,this.fc[b]);a.getPosition()};_.x(hR,Z);hR.prototype.a=function(){return 22+(this.cc.byteLength+3)+Z.prototype.a.call(this)};
55
+ hR.prototype.write=function(a){Z.prototype.write.call(this,a);HQ(a,3);HQ(a,23+this.cc.byteLength);JQ(a,1);HQ(a,0);HQ(a,4);HQ(a,15+this.cc.byteLength);HQ(a,64);HQ(a,21);IQ(a,0);_.V(a,0);_.V(a,0);HQ(a,5);HQ(a,this.cc.byteLength);_.Xm(a,this.cc);_.Xm(a,new Uint8Array([6,1,2]));a.getPosition()};_.x(iR,Z);iR.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};iR.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.Xm(a,MQ(this.location));a.getPosition()};
56
+ _.x(jR,Z);jR.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)};jR.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(kR,NQ);_.x(lR,Z);lR.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
+ lR.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(mR,Z);mR.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)};mR.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(nR,Z);
58
+ nR.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)};nR.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(oR,Z);oR.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
+ oR.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(pR,Z);pR.prototype.a=function(){return 8+Z.prototype.a.call(this)};pR.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);_.V(a,0);a.getPosition()};_.x(qR,Z);qR.prototype.a=function(){return 4+Z.prototype.a.call(this)};qR.prototype.write=function(a){Z.prototype.write.call(this,a);LQ(a,0);JQ(a,0);a.getPosition()};
60
+ _.x(rR,NQ);_.x(sR,NQ);_.x(tR,NQ);_.x(uR,Z);uR.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};uR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?GQ(a,this.baseMediaDecodeTime):_.V(a,this.baseMediaDecodeTime);a.getPosition()};_.x(vR,Z);vR.prototype.a=function(){return 4+Z.prototype.a.call(this)};vR.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);a.getPosition()};_.x(wR,Z);
61
+ wR.prototype.a=function(){var a=4;this.flags&uS&&(a+=4);this.flags&vS&&(a+=4);for(var b=0;b<this.h;b++)this.flags&wS&&(a+=4),this.flags&xS&&(a+=4),this.flags&yS&&(a+=4),this.flags&zS&&(a+=4);return a+Z.prototype.a.call(this)};
62
+ wR.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&uS&&(a.getPosition(),KQ(a,this.l));this.flags&vS&&_.V(a,this.o);for(var b=0;b<this.h;b++)this.flags&wS&&_.V(a,this.w[b]),this.flags&xS&&_.V(a,this.sampleSize[b]),this.flags&yS&&_.V(a,this.B[b]),this.flags&zS&&(0===this.version?_.V(a,this.j[b]):KQ(a,this.j[b]));a.getPosition()};var uS=1,vS=4,wS=256,xS=512,yS=1024,zS=2048;_.x(xR,Z);
63
+ xR.prototype.a=function(){var a=4;this.flags&AS&&(a+=8);this.flags&BS&&(a+=4);this.flags&CS&&(a+=4);this.flags&DS&&(a+=4);this.flags&ES&&(a+=4);return a+Z.prototype.a.call(this)};xR.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&AS&&GQ(a,this.j);this.flags&BS&&_.V(a,this.B);this.flags&CS&&_.V(a,this.l);this.flags&DS&&_.V(a,this.w);this.flags&ES&&_.V(a,this.o);a.getPosition()};var AS=1,BS=2,CS=8,DS=16,ES=32;_.x(yR,NQ);_.x(zR,NQ);_.x(AR,NQ);
64
+ AR.prototype.a=function(){return this.h.byteLength+NQ.prototype.a.call(this)};AR.prototype.write=function(a){NQ.prototype.write.call(this,a);0<this.h.byteLength&&_.Xm(a,this.h)};_.x(BR,Z);BR.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
+ BR.prototype.write=function(a){Z.prototype.write.call(this,a);HQ(a,0);0===this.version?HQ(a,0):HQ(a,0);HQ(a,this.h);HQ(a,this.j);_.Xm(a,_.Mj(this.o));if(1===this.h&&0===this.j){HQ(a,0);for(var b=0;b<this.l.length;b++)HQ(a,this.l[b])}a.getPosition()};_.x(CR,Z);CR.prototype.a=function(){var a=8;this.flags&1&&(a+=MQ(this.Xb).byteLength);return a+Z.prototype.a.call(this)};CR.prototype.write=function(a){Z.prototype.write.call(this,a);_.Xm(a,MQ(this.h));_.V(a,this.j);this.flags&1&&_.Xm(a,MQ(this.Xb));a.getPosition()};
66
+ _.x(DR,NQ);DR.prototype.a=function(){return MQ(this.h).byteLength+NQ.prototype.a.call(this)};DR.prototype.write=function(a){NQ.prototype.write.call(this,a);_.Xm(a,MQ(this.h));a.getPosition()};_.x(ER,Z);ER.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
+ ER.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]):GQ(a,this.offset[b]);a.getPosition()};_.x(FR,Z);FR.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
+ FR.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));HQ(a,this.h);_.V(a,this.j);if(0===this.h)for(var b=0;b<this.j;b++)HQ(a,this.l[b]);a.getPosition()};_.x(GR,Z);GR.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.j;b++)if(a+=this.h[b].Rh.byteLength,this.flags&2){a+=2;for(var c=0;c<this.h[b].kd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
69
+ GR.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.j);this.flags&1&&HQ(a,this.l);for(var b=0;b<this.j;b++)if(_.Xm(a,this.h[b].Rh),this.flags&2){JQ(a,this.h[b].kd);for(var c=0;c<this.h[b].kd;c++)JQ(a,this.h[b].wg[c].Pg),_.V(a,this.h[b].wg[c].Qg)}a.getPosition()};var NR=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,OR=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,PR=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,QR=/^(\d*\.?\d*)f$/,RR=/^(\d*\.?\d*)t$/,SR=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;WR.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};WR.prototype.write=function(){this.f=VR(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var $R=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.u=fS.prototype;_.u.configure=function(a){this.f=a};_.u.start=function(a,b){var c=this;this.D=b;var d=_.ah(new Set([a,HR(a)])).concat();return gS(this,d).then(function(e){return nS(c,e.data).then(function(){sS(c,c.A);return c.h})})};_.u.requestStop=function(){};_.u.stop=function(){this.D&&this.D.networkingEngine.ae(this.K);this.A=this.w=this.h=this.f=this.D=null;this.j&&(clearTimeout(this.j),this.j=null);this.J=!1;this.I=this.C=Infinity;return Promise.resolve()};
70
+ _.u.update=function(){var a=this;if(this.yd())return gS(this,[this.l]).then(function(b){return nS(a,b.data).then(function(){return a.h})})["catch"](function(b){if(a.D)a.D.onError(b)})};_.u.setCurrentVariant=function(){};_.u.Vb=function(){var a=this;this.g.debug(_.SC);this.D&&(this.j=null,this.update().then(function(){sS(a,a.A)})["catch"](function(b){a.D&&(a.D.onError(b),1===b.severity&&sS(a,100))}))};_.u.yd=function(){return this.L===jS};_.u.Of=function(){return 0<this.o.length};
71
+ _.u.Dh=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
+ _.u.pn=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.yd.bind(this),Ee:this.Of.bind(this),gl:function(){return 1},Be:this.Dh.bind(this)},d=!1,e=new _.N(_.P,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=bS(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 qS={video:_.Eg,audio:_.dd,text:_.Xc},eS=_.kc,jS="LIVE",rS={Un:_.nd,ao:_.ig};_.x(tS,_.tt);tS.prototype.f=function(){_.su.ism=fS;_.qu[_.Yc]=fS};tS.prototype.a=function(){_.iF("ism");_.jF(_.Yc)};tS.prototype.id=function(){return _.$f};_.J("clpp.smooth.SmoothComponent",tS);};
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 Ay="No thumbnail found for position: ",By="Position is out of range: ",Cy="Thumbnail URL is mandatory",Dy="Wrong gridSize format",Ey="clpp.thumbnails",Fy=function(){this.log=new _.K(Ey);this.player=null;this.a=[];this.w=!1},Hy=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Ue&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return Gy(a,0,e,!!f)})},Promise.resolve())},Gy=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return Iy(a,d).then(function(){return a.a[b].load()}).then(function(){return Gy(a,
3
- e,c,d)})},Iy=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.Dp)c();else a.player.one(_.jd,function(){c()})})},Jy=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.Bk=h;this.pn=l;this.rl=m;this.sl=n;this.Of=null},Ky=function(){Fy.call(this);
4
- this.f=null;this.o=this.h=1;this.j=0},Ly=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.ed=new _.ek},My=function(){this.g=new _.K(Ey);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.ek},Ny=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.ed.resolve()})},Py=function(a,b){return Oy(a,b).then(function(c){return new Jy(c,b.time,b.duration)})},Oy=function(a,b){return b.load().then(function(){var c=_.xj(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
- _.Hj(c)})},Qy=function(){Fy.call(this);this.f=null},Ry=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},Sy=function(){Fy.apply(this,arguments)},Ty=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Sd:c,Cg:d,Lh:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Uy=function(){this.g=new _.K(Ey);this.a=this.m=null},Vy=function(a){return a.some(function(b){return 0<
6
- b.thumbStreams.length})},$y=function(a){return a?a===Wy||a===Xy?new Ky:a===Yy?new Qy:a===Zy?new My:null:null},az=function(a){if(!a)return null;a=new _.Fk(a);return a.path.match(/.*\.vtt$/i)?Yy:a.path.match(/.*\.bif$/i)?Zy:a.path.match(/.*\.(png|jpg|jpeg)$/i)?Wy:null},bz=function(){};Fy.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Lf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&Hy(c,b.preload)})};Jy.prototype.raw=function(){return this.qa.cloneNode(!1)};
7
- Jy.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(_.Wd);e.style.width=c+_.If;e.style.height=d+_.If;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/
2
+ var f=function(window){var hz="No thumbnail found for position: ",iz="Position is out of range: ",jz="Thumbnail URL is mandatory",kz="Wrong gridSize format",lz="clpp.thumbnails",mz=function(){this.log=new _.K(lz);this.player=null;this.a=[];this.w=!1},oz=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Ue&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return nz(a,0,e,!!f)})},Promise.resolve())},nz=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return pz(a,d).then(function(){return a.a[b].load()}).then(function(){return nz(a,
3
+ e,c,d)})},pz=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.Lp)c();else a.player.one(_.jd,function(){c()})})},qz=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.Ek=h;this.sn=l;this.ul=m;this.vl=n;this.Pf=null},rz=function(){mz.call(this);
4
+ this.f=null;this.o=this.h=1;this.j=0},sz=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.ed=new _.gk},tz=function(){this.g=new _.K(lz);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.gk},uz=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.ed.resolve()})},wz=function(a,b){return vz(a,b).then(function(c){return new qz(c,b.time,b.duration)})},vz=function(a,b){return b.load().then(function(){var c=_.zj(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
+ _.Jj(c)})},xz=function(){mz.call(this);this.f=null},yz=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},zz=function(){mz.apply(this,arguments)},Az=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Sd:c,Fg:d,Qh:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Bz=function(){this.g=new _.K(lz);this.a=this.m=null},Cz=function(a){return a.some(function(b){return 0<
6
+ b.thumbStreams.length})},Hz=function(a){return a?a===Dz||a===Ez?new rz:a===Fz?new xz:a===Gz?new tz:null:null},Iz=function(a){if(!a)return null;a=new _.Jk(a);return a.path.match(/.*\.vtt$/i)?Fz:a.path.match(/.*\.bif$/i)?Gz:a.path.match(/.*\.(png|jpg|jpeg)$/i)?Dz:null},Jz=function(){};mz.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Lf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&oz(c,b.preload)})};qz.prototype.raw=function(){return this.qa.cloneNode(!1)};
7
+ qz.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(_.Wd);e.style.width=c+_.If;e.style.height=d+_.If;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
8
  this.height*(this.qa.naturalHeight||this.qa.height))+_.If;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.If;e.style.backgroundPositionY="-"+f*d+_.If;return e};
9
- Jy.prototype.load=function(){var a=this;this.Of||(this.Of=new Promise(function(b,c){function d(){a.width||(a.width=(a.qa.naturalWidth||a.qa.width)/a.Bk);a.height||(a.height=(a.qa.naturalHeight||a.qa.height)/a.pn);a.x||(a.x=a.width*a.rl);a.y||(a.y=a.height*a.sl)}if(a.qa.src&&a.qa.complete)d(),b(a);else{var e=null,f=function(){d();a.qa.removeEventListener(_.Ee,f);a.qa.removeEventListener(_.ne,e);b(a)};e=function(g){a.qa.removeEventListener(_.Ee,f);a.qa.removeEventListener(_.ne,e);c(new _.N(1,9,2014,
10
- "Failed to load thumbnail.",g))};a.qa.addEventListener(_.Ee,f);a.qa.addEventListener(_.ne,e);a.qa.src=a.src}}));return this.Of};_.J("clpp.thumbnails.Thumbnail",Jy);Jy.prototype.load=Jy.prototype.load;Jy.prototype.element=Jy.prototype.element;Jy.prototype.raw=Jy.prototype.raw;_.x(Ky,Fy);
11
- Ky.prototype.init=function(a,b){if(!b||!b.url)throw new _.N(1,9,7100,Cy);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,Dy);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
- new _.N(1,9,7100,Dy);}Fy.prototype.init.call(this,a,b)};Ky.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,By+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
- Ky.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 Jy(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()};Ly.prototype.load=function(){return this.ed};
14
- My.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.N(1,9,7100,Cy);var d=b.url,e=_.Wj(d);e.type=_.Vj;a.getNetworkEngine().fetch(e).U.then(function(f){f=f.data;var g=_.xj(c.f);f=_.xj(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=_.xj(l);n=String.fromCharCode.apply(null,
15
- cz);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 Ly(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
- Ny(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))})};My.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,By+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,Ay+a);return _.y(e,Py(b,c),3);case 3:return d=e.f,_.y(e,d.load(),4);case 4:return e["return"](d)}})};
17
- My.prototype.vc=function(){return 0<this.a.length};var cz=[137,66,73,70,13,10,26,10];_.x(Qy,Fy);
18
- Qy.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.N(1,9,7100,Cy);var d=b.url,e=_.Wj(d);e.type=_.Vj;this.f=a.getNetworkEngine().fetch(e).U.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.R.aa(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 t=h.indexOf("#");h=0>t?h:h.substr(0,t);h.match(/^http|^\/\//)||(h=
19
- d.substr(0,d.lastIndexOf("/"))+"/"+h);t=Ry(l[0]);l=Ry(l[1])-t;c.a.push(new Jy(h,t,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))});Fy.prototype.init.call(this,a,b)};
20
- Qy.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,By+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,Ay+a);return _.y(d,c.load(),3)}return d["return"](c)})};Qy.prototype.l=function(){return this.f};_.x(Sy,Fy);
21
- Sy.prototype.get=function(a){function b(){return new _.N(1,9,2014,Ay+a)}var c=this,d,e,f,g,h,l,m,n,p,q,t,v,z;return _.I(function(C){if(1==C.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.N(1,9,2014,By+a);d=c.player.getPeriods();for(var F=null,G=_.w(d),A=G.next();!A.done;A=G.next())A=A.value,A.startTime<=a&&(F=A);e=F;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=Ty(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.Lh+m])):(q=h.Va())&&0<q.length&&(v=t=0,z=h.startTime,1<l.Lh&&(t=m%l.Sd,v=Math.floor(m/l.Sd),z+=m*l.durationPerTile),n=new Jy(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.Sd,l.Cg,
23
- t,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();})};Sy.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
- Sy.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.R(d=b.getSegmentReference(c++));)for(var e=Ty(d,b),f=d.Va()[0],g=new Image,h=d.startTime,l=0;l<e.Cg;++l)for(var m=0;m<e.Sd;++m)this.a.push(new Jy(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Sd,e.Cg,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.u=Uy.prototype;_.u.onPlayerCreated=function(a){this.m=a};_.u.onPlayerWillDestroy=function(){this.m=null};_.u.onPlayerWillRelease=function(){this.a=null};
25
- _.u.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=az(c.url||null));(this.a=$y(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.He,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
- _.u.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(Vy(d)){this.a=new Sy;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.u.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.N(1,9,2014,"Thumbnail format is not supported"))};_.u.id=function(){return"thumbnails"};_.J("clpp.thumbnails.ThumbnailsPlugin",Uy);Uy.prototype.get=Uy.prototype.get;Uy.Id="thumbnails";
27
- bz.prototype.create=function(){return new Uy};_.Fs(new bz);var Wy="SINGLE",Xy="GRID",Yy="WEBVTT",Zy="BIF";};
9
+ qz.prototype.load=function(){var a=this;this.Pf||(this.Pf=new Promise(function(b,c){function d(){a.width||(a.width=(a.qa.naturalWidth||a.qa.width)/a.Ek);a.height||(a.height=(a.qa.naturalHeight||a.qa.height)/a.sn);a.x||(a.x=a.width*a.ul);a.y||(a.y=a.height*a.vl)}if(a.qa.src&&a.qa.complete)d(),b(a);else{var e=null,f=function(){d();a.qa.removeEventListener(_.Ee,f);a.qa.removeEventListener(_.ne,e);b(a)};e=function(g){a.qa.removeEventListener(_.Ee,f);a.qa.removeEventListener(_.ne,e);c(new _.N(1,9,2014,
10
+ "Failed to load thumbnail.",g))};a.qa.addEventListener(_.Ee,f);a.qa.addEventListener(_.ne,e);a.qa.src=a.src}}));return this.Pf};_.J("clpp.thumbnails.Thumbnail",qz);qz.prototype.load=qz.prototype.load;qz.prototype.element=qz.prototype.element;qz.prototype.raw=qz.prototype.raw;_.x(rz,mz);
11
+ rz.prototype.init=function(a,b){if(!b||!b.url)throw new _.N(1,9,7100,jz);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,kz);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
+ new _.N(1,9,7100,kz);}mz.prototype.init.call(this,a,b)};rz.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,iz+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
+ rz.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 qz(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()};sz.prototype.load=function(){return this.ed};
14
+ tz.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.N(1,9,7100,jz);var d=b.url,e=_.Yj(d);e.type=_.Xj;a.getNetworkEngine().fetch(e).U.then(function(f){f=f.data;var g=_.zj(c.f);f=_.zj(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=_.zj(l);n=String.fromCharCode.apply(null,
15
+ Kz);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 sz(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
+ uz(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))})};tz.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,iz+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,hz+a);return _.y(e,wz(b,c),3);case 3:return d=e.f,_.y(e,d.load(),4);case 4:return e["return"](d)}})};
17
+ tz.prototype.vc=function(){return 0<this.a.length};var Kz=[137,66,73,70,13,10,26,10];_.x(xz,mz);
18
+ xz.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.N(1,9,7100,jz);var d=b.url,e=_.Yj(d);e.type=_.Xj;this.f=a.getNetworkEngine().fetch(e).U.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.R.aa(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 t=h.indexOf("#");h=0>t?h:h.substr(0,t);h.match(/^http|^\/\//)||(h=
19
+ d.substr(0,d.lastIndexOf("/"))+"/"+h);t=yz(l[0]);l=yz(l[1])-t;c.a.push(new qz(h,t,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))});mz.prototype.init.call(this,a,b)};
20
+ xz.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,iz+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,hz+a);return _.y(d,c.load(),3)}return d["return"](c)})};xz.prototype.l=function(){return this.f};_.x(zz,mz);
21
+ zz.prototype.get=function(a){function b(){return new _.N(1,9,2014,hz+a)}var c=this,d,e,f,g,h,l,m,n,p,q,t,v,z;return _.I(function(C){if(1==C.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.N(1,9,2014,iz+a);d=c.player.getPeriods();for(var F=null,G=_.w(d),B=G.next();!B.done;B=G.next())B=B.value,B.startTime<=a&&(F=B);e=F;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=Az(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.Qh+m])):(q=h.Xa())&&0<q.length&&(v=t=0,z=h.startTime,1<l.Qh&&(t=m%l.Sd,v=Math.floor(m/l.Sd),z+=m*l.durationPerTile),n=new qz(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.Sd,l.Fg,
23
+ t,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();})};zz.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
+ zz.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.R(d=b.getSegmentReference(c++));)for(var e=Az(d,b),f=d.Xa()[0],g=new Image,h=d.startTime,l=0;l<e.Fg;++l)for(var m=0;m<e.Sd;++m)this.a.push(new qz(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Sd,e.Fg,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.u=Bz.prototype;_.u.onPlayerCreated=function(a){this.m=a};_.u.onPlayerWillDestroy=function(){this.m=null};_.u.onPlayerWillRelease=function(){this.a=null};
25
+ _.u.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=Iz(c.url||null));(this.a=Hz(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Ge,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
+ _.u.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(Cz(d)){this.a=new zz;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.u.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.N(1,9,2014,"Thumbnail format is not supported"))};_.u.id=function(){return"thumbnails"};_.J("clpp.thumbnails.ThumbnailsPlugin",Bz);Bz.prototype.get=Bz.prototype.get;Bz.Id="thumbnails";
27
+ Jz.prototype.create=function(){return new Bz};_.Qs(new Jz);var Dz="SINGLE",Ez="GRID",Fz="WEBVTT",Gz="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));}