Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. new ((function r(n){function t(r){if(i[r])return i[r].exports;var u=i[r]={i:r,l:!1,exports:{}};return n[r].call(u.exports,u,u.exports,t),u.l=!0,u.exports}var i={},r;return t.m=n,t.c=i,t.i=function(n){return n},t.d=function(n,i,r){t.o(n,i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get:r})},t.r=function(n){Object.defineProperty(n,"__esModule",{value:!0})},t.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(i,"a",i),i},t.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},t.p="/",t.oe=function(n){throw console.error(n),n;},r=t(t.s=52),r.default||r})({52: function(n,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var u=i(21),r=i(1),f=i(0),e=i(53);t.default=function(n){var t=new e.EventEmitter,i;t.trigger=function(n){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];t.emit.apply(t,[n,n].concat(r))};t.off=function(n){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];t.removeListener.apply(t,[n].concat(r))};i=function(t,i){n.postMessage({event:t,data:i})};n.addEventListener("message",function(r){var e=r.data,o;switch(e.cmd){case"init":o=JSON.parse(e.config);n.demuxer=new u.default(t,e.typeSupported,o,e.vendor);f.enableLogs(o.debug);i("init",null);break;case"demux":n.demuxer.push(e.data,e.decryptdata,e.initSegment,e.audioCodec,e.videoCodec,e.timeOffset,e.discontinuity,e.trackSwitch,e.contiguous,e.duration,e.accurateTimeOffset,e.defaultInitPTS)}});t.on(r.default.FRAG_DECRYPTED,i);t.on(r.default.FRAG_PARSING_INIT_SEGMENT,i);t.on(r.default.FRAG_PARSED,i);t.on(r.default.ERROR,i);t.on(r.default.FRAG_PARSING_METADATA,i);t.on(r.default.FRAG_PARSING_USERDATA,i);t.on(r.default.INIT_PTS_FOUND,i);t.on(r.default.FRAG_PARSING_DATA,function(t,i){var r=[],u={event:t,data:i};i.data1&&(u.data1=i.data1.buffer,r.push(i.data1.buffer),delete i.data1);i.data2&&(u.data2=i.data2.buffer,r.push(i.data2.buffer),delete i.data2);n.postMessage(u,r)})}},53: function(n){function t(){this._events=this._events||{};this._maxListeners=this._maxListeners||void 0}function i(n){return"function"==typeof n}function r(n){return"object"==typeof n&&null!==n}function u(n){return void 0===n}n.exports=t;t.EventEmitter=t;t.prototype._events=void 0;t.prototype._maxListeners=void 0;t.defaultMaxListeners=10;t.prototype.setMaxListeners=function(n){if(!function(n){return"number"==typeof n}(n)||n<0||isNaN(n))throw TypeError("n must be a positive number");return this._maxListeners=n,this};t.prototype.emit=function(n){var f,t,h,e,o,c,s;if(this._events||(this._events={}),"error"===n&&(!this._events.error||r(this._events.error)&&!this._events.error.length)){if((f=arguments[1])instanceof Error)throw f;s=new Error('Uncaught, unspecified "error" event. ('+f+")");throw s.context=f,s;}if(u(t=this._events[n]))return!1;if(i(t))switch(arguments.length){case 1:t.call(this);break;case 2:t.call(this,arguments[1]);break;case 3:t.call(this,arguments[1],arguments[2]);break;default:e=Array.prototype.slice.call(arguments,1);t.apply(this,e)}else if(r(t))for(e=Array.prototype.slice.call(arguments,1),h=(c=t.slice()).length,o=0;o<h;o++)c[o].apply(this,e);return!0};t.prototype.addListener=function(n,f){var e;if(!i(f))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",n,i(f.listener)?f.listener:f),this._events[n]?r(this._events[n])?this._events[n].push(f):this._events[n]=[this._events[n],f]:this._events[n]=f,r(this._events[n])&&!this._events[n].warned&&(e=u(this._maxListeners)?t.defaultMaxListeners:this._maxListeners)&&e>0&&this._events[n].length>e&&(this._events[n].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[n].length),"function"==typeof console.trace&&console.trace()),this};t.prototype.on=t.prototype.addListener;t.prototype.once=function(n,t){function r(){this.removeListener(n,r);u||(u=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var u=!1;return r.listener=t,this.on(n,r),this};t.prototype.removeListener=function(n,t){var u,e,o,f;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[n])return this;if(o=(u=this._events[n]).length,e=-1,u===t||i(u.listener)&&u.listener===t)delete this._events[n],this._events.removeListener&&this.emit("removeListener",n,t);else if(r(u)){for(f=o;f-->0;)if(u[f]===t||u[f].listener&&u[f].listener===t){e=f;break}if(e<0)return this;1===u.length?(u.length=0,delete this._events[n]):u.splice(e,1);this._events.removeListener&&this.emit("removeListener",n,t)}return this};t.prototype.removeAllListeners=function(n){var r,t;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[n]&&delete this._events[n],this;if(0===arguments.length){for(r in this._events)"removeListener"!==r&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events={},this}if(i(t=this._events[n]))this.removeListener(n,t);else if(t)for(;t.length;)this.removeListener(n,t[t.length-1]);return delete this._events[n],this};t.prototype.listeners=function(n){return this._events&&this._events[n]?i(this._events[n])?[this._events[n]]:this._events[n].slice():[]};t.prototype.listenerCount=function(n){if(this._events){var t=this._events[n];if(i(t))return 1;if(t)return t.length}return 0};t.listenerCount=function(n,t){return n.listenerCount(t)}},0: function(n,t,i){"use strict";function r(){}function s(n){for(var i=[],t=1;t<arguments.length;t++)i[t-1]=arguments[t];i.forEach(function(t){u[t]=n[t]?n[t].bind(n):function(n){var t=o.console[n];return t?function(){for(var i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];i[0]&&(i[0]=function(n,t){return"["+n+"] > "+t}(n,i[0]));t.apply(o.console,i)}:r}(t)})}var e;Object.defineProperty(t,"__esModule",{value:!0});e=i(6);var f={trace:r,debug:r,log:r,warn:r,info:r,error:r},u=f,o=e.getSelfScope();t.enableLogs=function(n){if(!0===n||"object"==typeof n){s(n,"debug","log","info","warn","error");try{u.log()}catch(n){u=f}}else u=f};t.logger=u},6: function(n,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.getSelfScope=function(){return"undefined"==typeof window?self:window}},1: function(n,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",BUFFER_CREATED:"hlsBufferCreated",BUFFER_APPENDING:"hlsBufferAppending",BUFFER_APPENDED:"hlsBufferAppended",BUFFER_EOS:"hlsBufferEos",BUFFER_FLUSHING:"hlsBufferFlushing",BUFFER_FLUSHED:"hlsBufferFlushed",MANIFEST_LOADING:"hlsManifestLoading",MANIFEST_LOADED:"hlsManifestLoaded",MANIFEST_PARSED:"hlsManifestParsed",LEVEL_SWITCHING:"hlsLevelSwitching",LEVEL_SWITCHED:"hlsLevelSwitched",LEVEL_LOADING:"hlsLevelLoading",LEVEL_LOADED:"hlsLevelLoaded",LEVEL_UPDATED:"hlsLevelUpdated",LEVEL_PTS_UPDATED:"hlsLevelPtsUpdated",AUDIO_TRACKS_UPDATED:"hlsAudioTracksUpdated",AUDIO_TRACK_SWITCHING:"hlsAudioTrackSwitching",AUDIO_TRACK_SWITCHED:"hlsAudioTrackSwitched",AUDIO_TRACK_LOADING:"hlsAudioTrackLoading",AUDIO_TRACK_LOADED:"hlsAudioTrackLoaded",SUBTITLE_TRACKS_UPDATED:"hlsSubtitleTracksUpdated",SUBTITLE_TRACK_SWITCH:"hlsSubtitleTrackSwitch",SUBTITLE_TRACK_LOADING:"hlsSubtitleTrackLoading",SUBTITLE_TRACK_LOADED:"hlsSubtitleTrackLoaded",SUBTITLE_FRAG_PROCESSED:"hlsSubtitleFragProcessed",INIT_PTS_FOUND:"hlsInitPtsFound",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",FRAG_DECRYPTED:"hlsFragDecrypted",FRAG_PARSING_INIT_SEGMENT:"hlsFragParsingInitSegment",FRAG_PARSING_USERDATA:"hlsFragParsingUserdata",FRAG_PARSING_METADATA:"hlsFragParsingMetadata",FRAG_PARSING_DATA:"hlsFragParsingData",FRAG_PARSED:"hlsFragParsed",FRAG_BUFFERED:"hlsFragBuffered",FRAG_CHANGED:"hlsFragChanged",FPS_DROP:"hlsFpsDrop",FPS_DROP_LEVEL_CAPPING:"hlsFpsDropLevelCapping",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded",STREAM_STATE_TRANSITION:"hlsStreamStateTransition"}},21: function(n,t,i){"use strict";var s;Object.defineProperty(t,"__esModule",{value:!0});var r,e=i(1),o=i(3),h=i(13),c=i(42),l=i(17),a=i(43),v=i(46),u=i(47),y=i(50),p=i(6),w=i(0),f=p.getSelfScope();try{r=f.performance.now.bind(f.performance)}catch(n){w.logger.debug("Unable to use Performance API on this environment");r=f.Date.now}s=function(){function n(n,t,i,r){this.observer=n;this.typeSupported=t;this.config=i;this.vendor=r}return n.prototype.destroy=function(){var n=this.demuxer;n&&n.destroy()},n.prototype.push=function(n,t,i,u,f,o,s,c,l,a,v,y){var w=this,p,b;n.byteLength>0&&null!=t&&null!=t.key&&"AES-128"===t.method?(p=this.decrypter,null==p&&(p=this.decrypter=new h.default(this.observer,this.config)),b=r(),p.decrypt(n,t.key.buffer,t.iv.buffer,function(n){var h=r();w.observer.trigger(e.default.FRAG_DECRYPTED,{stats:{tstart:b,tdecrypt:h}});w.pushDecrypted(new Uint8Array(n),t,new Uint8Array(i),u,f,o,s,c,l,a,v,y)})):this.pushDecrypted(new Uint8Array(n),t,new Uint8Array(i),u,f,o,s,c,l,a,v,y)},n.prototype.pushDecrypted=function(n,t,i,r,f,s,h,p,w,b,k,d){var g=this.demuxer,nt,rt,st,ut;if(!g||(h||p)&&!this.probe(n)){for(var tt=this.observer,ft=this.typeSupported,et=this.config,ot=[{demux:a.default,remux:u.default},{demux:l.default,remux:y.default},{demux:c.default,remux:u.default},{demux:v.default,remux:u.default}],it=0,ht=ot.length;it<ht;it++)if(nt=ot[it],rt=nt.demux.probe,rt(n)){st=this.remuxer=new nt.remux(tt,et,ft,this.vendor);g=new nt.demux(tt,st,et,ft);this.probe=rt;break}if(!g)return void tt.trigger(e.default.ERROR,{type:o.ErrorTypes.MEDIA_ERROR,details:o.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"});this.demuxer=g}ut=this.remuxer;(h||p)&&(g.resetInitSegment(i,r,f,b),ut.resetInitSegment());h&&(g.resetTimeStamp(d),ut.resetTimeStamp(d));"function"==typeof g.setDecryptData&&g.setDecryptData(t);g.append(n,s,w,k)},n}();t.default=s},50: function(n,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=i(1),u=function(){function n(n){this.observer=n}return n.prototype.destroy=function(){},n.prototype.resetTimeStamp=function(){},n.prototype.resetInitSegment=function(){},n.prototype.remux=function(n,t,i,u,f,e,o,s){var c=this.observer,h="";n&&(h+="audio");t&&(h+="video");c.trigger(r.default.FRAG_PARSING_DATA,{data1:s,startPTS:f,startDTS:f,type:h,hasAudio:!!n,hasVideo:!!t,nb:1,dropped:0});c.trigger(r.default.FRAG_PARSED)},n}();t.default=u},47: function(n,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=i(48),f=i(49),u=i(1),e=i(3),r=i(0),s=function(){function n(n,t,i,r){this.observer=n;this.config=t;this.typeSupported=i;var u=navigator.userAgent;this.isSafari=r&&r.indexOf("Apple")>-1&&u&&!u.match("CriOS");this.ISGenerated=!1}return n.prototype.destroy=function(){},n.prototype.resetTimeStamp=function(n){this._initPTS=this._initDTS=n},n.prototype.resetInitSegment=function(){this.ISGenerated=!1},n.prototype.remux=function(n,t,i,f,e,o,s){var v,h,y,p;if(this.ISGenerated||this.generateIS(n,t,e),this.ISGenerated){var w=n.samples.length,c=t.samples.length,l=e,a=e;w&&c&&(v=(n.samples[0].pts-t.samples[0].pts)/t.inputTimeScale,l+=Math.max(0,v),a+=Math.max(0,-v));w?(n.timescale||(r.logger.warn("regenerate InitSegment as audio detected"),this.generateIS(n,t,e)),h=this.remuxAudio(n,l,o,s),c&&(y=void 0,h&&(y=h.endPTS-h.startPTS),t.timescale||(r.logger.warn("regenerate InitSegment as video detected"),this.generateIS(n,t,e)),this.remuxVideo(t,a,o,y,s))):c&&(p=this.remuxVideo(t,a,o,0,s),p&&n.codec&&this.remuxEmptyAudio(n,l,o,p))}i.samples.length&&this.remuxID3(i,e);f.samples.length&&this.remuxText(f,e);this.observer.trigger(u.default.FRAG_PARSED)},n.prototype.generateIS=function(n,t,i){var o,s,y=this.observer,p=n.samples,a=t.samples,v=this.typeSupported,w="audio/mp4",h={},b={tracks:h},c=void 0===this._initPTS,l;(c&&(o=s=1/0),n.config&&p.length&&(n.timescale=n.samplerate,r.logger.log("audio sampling rate : "+n.samplerate),n.isAAC||(v.mpeg?(w="audio/mpeg",n.codec=""):v.mp3&&(n.codec="mp3")),h.audio={container:w,codec:n.codec,initSegment:!n.isAAC&&v.mpeg?new Uint8Array:f.default.initSegment([n]),metadata:{channelCount:n.channelCount}},c&&(o=s=p[0].pts-n.inputTimeScale*i)),t.sps&&t.pps&&a.length)&&(l=t.inputTimeScale,t.timescale=l,h.video={container:"video/mp4",codec:t.codec,initSegment:f.default.initSegment([t]),metadata:{width:t.width,height:t.height}},c&&(o=Math.min(o,a[0].pts-l*i),s=Math.min(s,a[0].dts-l*i),this.observer.trigger(u.default.INIT_PTS_FOUND,{initPTS:o})));Object.keys(h).length?(y.trigger(u.default.FRAG_PARSING_INIT_SEGMENT,b),this.ISGenerated=!0,c&&(this._initPTS=o,this._initDTS=s)):y.trigger(u.default.ERROR,{type:e.ErrorTypes.MEDIA_ERROR,details:e.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})},n.prototype.remuxVideo=function(n,t,i,o,s){var l,nt,ni,b,a,ti,ut,ft=8,y=n.timescale,h=n.samples,tt=[],et=h.length,ii=this._PTSNormalize,ct=this._initPTS,p=this.nextAvcDts,ot=this.isSafari,st,c,g,w,lt,at,it,yt,bt,rt,oi,dt,gt;if(0!==et){if(ot&&(i|=h.length&&p&&(s&&Math.abs(t-p/y)<.1||Math.abs(h[0].pts-p-ct)<y/5)),i||(p=t*y),h.forEach(function(n){n.pts=ii(n.pts-ct,p);n.dts=ii(n.dts-ct,p)}),h.sort(function(n,t){var i=n.dts-t.dts,r=n.pts-t.pts;return i||r||n.id-t.id}),st=h.reduce(function(n,t){return Math.max(Math.min(n,t.pts-t.dts),-18e3)},0),st<0)for(r.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Math.round(st/90)+" ms to overcome this issue"),c=0;c<h.length;c++)h[c].dts+=st;for(g=h[0],a=Math.max(g.dts,0),b=Math.max(g.pts,0),w=Math.round((a-p)/90),i&&w&&(w>1?r.logger.log("AVC:"+w+" ms hole between fragments detected,filling it"):w<-1&&r.logger.log("AVC:"+-w+" ms overlapping between fragments detected"),a=p,h[0].dts=a,b=Math.max(b-w,p),h[0].pts=b,r.logger.log("Video/PTS/DTS adjusted: "+Math.round(b/90)+"/"+Math.round(a/90)+",delta:"+w+" ms")),g=h[h.length-1],ut=Math.max(g.dts,0),ti=Math.max(g.pts,0,ut),ot&&(l=Math.round((ut-a)/(h.length-1))),lt=0,at=0,c=0;c<et;c++){for(var k=h[c],ri=k.units,ht=ri.length,vt=0,d=0;d<ht;d++)vt+=ri[d].data.length;at+=vt;lt+=ht;k.length=vt;k.dts=ot?a+c*l:Math.max(k.dts,a);k.pts=Math.max(k.pts,k.dts)}it=at+4*lt+8;try{nt=new Uint8Array(it)}catch(n){return void this.observer.trigger(u.default.ERROR,{type:e.ErrorTypes.MUX_ERROR,details:e.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:it,reason:"fail allocating video mdat "+it})}for(yt=new DataView(nt.buffer),yt.setUint32(0,it),nt.set(f.default.types.mdat,4),c=0;c<et;c++){var v=h[c],ui=v.units,fi=0,pt=void 0;for(d=0,ht=ui.length;d<ht;d++){var ei=ui[d],si=ei.data,wt=ei.data.byteLength;yt.setUint32(ft,wt);ft+=4;nt.set(si,ft);ft+=wt;fi+=4+wt}if(ot)pt=Math.max(0,l*Math.round((v.pts-v.dts)/l));else{if(c<et-1)l=h[c+1].dts-v.dts;else if(bt=this.config,rt=v.dts-h[c>0?c-1:c].dts,bt.stretchShortVideoTrack){var hi=bt.maxBufferHole,ci=Math.floor(hi*y),kt=(o?b+o*y:this.nextAudioPts)-v.pts;kt>ci?((l=kt-rt)<0&&(l=rt),r.logger.log("It is approximately "+kt/90+" ms to the next segment; using duration "+l/90+" ms for the last video frame.")):l=rt}else l=rt;pt=Math.round(v.pts-v.dts)}tt.push({size:fi,duration:l,cts:pt,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:v.key?2:1,isNonSync:v.key?0:1}})}return this.nextAvcDts=ut+l,oi=n.dropped,(n.len=0,n.nbNalu=0,n.dropped=0,tt.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1)&&(dt=tt[0].flags,dt.dependsOn=2,dt.isNonSync=0),n.samples=tt,ni=f.default.moof(n.sequenceNumber++,a,n),n.samples=[],gt={data1:ni,data2:nt,startPTS:b/y,endPTS:(ti+l)/y,startDTS:a/y,endDTS:this.nextAvcDts/y,type:"video",hasAudio:!1,hasVideo:!0,nb:tt.length,dropped:oi},this.observer.trigger(u.default.FRAG_PARSING_DATA,gt),gt}},n.prototype.remuxAudio=function(n,t,i,s){var it,nt,c,tt,bt,at,st,h=n.inputTimeScale,ui=n.timescale,ht=h/ui,p=(n.isAAC?1024:1152)*ht,fi=this._PTSNormalize,kt=this._initPTS,ct=!n.isAAC&&this.typeSupported.mpeg,l=n.samples,rt=[],a=this.nextAudioPts,k,w,vt,yt,d,pt,gt,g,ft,et,wt,lt,ot;if(i|=l.length&&a&&(s&&Math.abs(t-a/h)<.1||Math.abs(l[0].pts-a-kt)<20*p),l.forEach(function(n){n.pts=n.dts=fi(n.pts-kt,t*h)}),0!==(l=l.filter(function(n){return n.pts>=0})).length){if(i||(a=s?t*h:l[0].pts),n.isAAC)for(var dt=this.config.maxAudioFramesDrift,v=0,y=a;v<l.length;)if(w=l[v],k=(b=w.pts)-y,vt=Math.abs(1e3*k/h),k<=-dt*p)r.logger.warn("Dropping 1 audio frame @ "+(y/h).toFixed(3)+"s due to "+Math.round(vt)+" ms overlap."),l.splice(v,1),n.len-=w.unit.length;else if(k>=dt*p&&vt<1e4&&y){for(yt=Math.round(k/p),r.logger.warn("Injecting "+yt+" audio frame @ "+(y/h).toFixed(3)+"s due to "+Math.round(1e3*k/h)+" ms gap."),d=0;d<yt;d++)pt=Math.max(y,0),(c=o.default.getSilentFrame(n.manifestCodec||n.codec,n.channelCount))||(r.logger.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),c=w.unit.subarray()),l.splice(v,0,{unit:c,pts:pt,dts:pt}),n.len+=c.length,y+=p,v++;w.pts=w.dts=y;y+=p;v++}else Math.abs(k),w.pts=w.dts=y,y+=p,v++;for(d=0,gt=l.length;d<gt;d++){var ni=l[d],ut=ni.unit,b=ni.pts;if(void 0!==st)nt.duration=Math.round((b-st)/ht);else{if(g=Math.round(1e3*(b-a)/h),ft=0,i&&n.isAAC&&g){if(g>0&&g<1e4)ft=Math.round((b-a)/p),r.logger.log(g+" ms hole between AAC samples detected,filling it"),ft>0&&((c=o.default.getSilentFrame(n.manifestCodec||n.codec,n.channelCount))||(c=ut.subarray()),n.len+=ft*c.length);else if(g<-12){r.logger.log("drop overlapping AAC sample, expected/parsed/delta:"+(a/h).toFixed(3)+"s/"+(b/h).toFixed(3)+"s/"+-g+"ms");n.len-=ut.byteLength;continue}b=a}if(at=b,!(n.len>0))return;et=ct?n.len:n.len+8;it=ct?0:8;try{tt=new Uint8Array(et)}catch(n){return void this.observer.trigger(u.default.ERROR,{type:e.ErrorTypes.MUX_ERROR,details:e.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:et,reason:"fail allocating audio mdat "+et})}for(ct||(new DataView(tt.buffer).setUint32(0,et),tt.set(f.default.types.mdat,4)),v=0;v<ft;v++)(c=o.default.getSilentFrame(n.manifestCodec||n.codec,n.channelCount))||(r.logger.log("Unable to get silent frame for given audio codec; duplicating this frame instead."),c=ut.subarray()),tt.set(c,it),it+=c.byteLength,nt={size:c.byteLength,cts:0,duration:1024,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},rt.push(nt)}tt.set(ut,it);wt=ut.byteLength;it+=wt;nt={size:wt,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}};rt.push(nt);st=b}if(lt=0,ot=rt.length,ot>=2&&(lt=rt[ot-2].duration,nt.duration=lt),ot){this.nextAudioPts=a=st+ht*lt;n.len=0;n.samples=rt;bt=ct?new Uint8Array:f.default.moof(n.sequenceNumber++,at/ht,n);n.samples=[];var ti=at/h,ii=a/h,ri={data1:bt,data2:tt,startPTS:ti,endPTS:ii,startDTS:ti,endDTS:ii,type:"audio",hasAudio:!0,hasVideo:!1,nb:ot};return this.observer.trigger(u.default.FRAG_PARSING_DATA,ri),ri}return null}},n.prototype.remuxEmptyAudio=function(n,t,i,u){var f=n.inputTimeScale,y=f/(n.samplerate?n.samplerate:f),l=this.nextAudioPts,a=(void 0!==l?l:u.startDTS*f)+this._initDTS,p=u.endDTS*f+this._initDTS,v=1024*y,w=Math.ceil((p-a)/v),s=o.default.getSilentFrame(n.manifestCodec||n.codec,n.channelCount),h,e,c;if(r.logger.warn("remux empty Audio"),s){for(h=[],e=0;e<w;e++)c=a+e*v,h.push({unit:s,pts:c,dts:c}),n.len+=s.length;n.samples=h;this.remuxAudio(n,t,i)}else r.logger.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!")},n.prototype.remuxID3=function(n){var t,r=n.samples.length,f=n.inputTimeScale,e=this._initPTS,o=this._initDTS,i;if(r){for(i=0;i<r;i++)(t=n.samples[i]).pts=(t.pts-e)/f,t.dts=(t.dts-o)/f;this.observer.trigger(u.default.FRAG_PARSING_METADATA,{samples:n.samples})}n.samples=[]},n.prototype.remuxText=function(n){var t;n.samples.sort(function(n,t){return n.pts-t.pts});var i,r=n.samples.length,f=n.inputTimeScale,e=this._initPTS;if(r){for(t=0;t<r;t++)(i=n.samples[t]).pts=(i.pts-e)/f;this.observer.trigger(u.default.FRAG_PARSING_USERDATA,{samples:n.samples})}n.samples=[]},n.prototype._PTSNormalize=function(n,t){var i;if(void 0===t)return n;for(i=t<n?-8589934592:8589934592;Math.abs(n-t)>4294967296;)n+=i;return n},n}();t.default=s},3: function(n,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.ErrorTypes={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",KEY_SYSTEM_ERROR:"keySystemError",MUX_ERROR:"muxError",OTHER_ERROR:"otherError"};t.ErrorDetails={KEY_SYSTEM_NO_KEYS:"keySystemNoKeys",KEY_SYSTEM_NO_ACCESS:"keySystemNoAccess",KEY_SYSTEM_NO_SESSION:"keySystemNoSession",KEY_SYSTEM_LICENSE_REQUEST_FAILED:"keySystemLicenseRequestFailed",MANIFEST_LOAD_ERROR:"manifestLoadError",MANIFEST_LOAD_TIMEOUT:"manifestLoadTimeOut",MANIFEST_PARSING_ERROR:"manifestParsingError",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"manifestIncompatibleCodecsError",LEVEL_LOAD_ERROR:"levelLoadError",LEVEL_LOAD_TIMEOUT:"levelLoadTimeOut",LEVEL_SWITCH_ERROR:"levelSwitchError",AUDIO_TRACK_LOAD_ERROR:"audioTrackLoadError",AUDIO_TRACK_LOAD_TIMEOUT:"audioTrackLoadTimeOut",FRAG_LOAD_ERROR:"fragLoadError",FRAG_LOAD_TIMEOUT:"fragLoadTimeOut",FRAG_DECRYPT_ERROR:"fragDecryptError",FRAG_PARSING_ERROR:"fragParsingError",REMUX_ALLOC_ERROR:"remuxAllocError",KEY_LOAD_ERROR:"keyLoadError",KEY_LOAD_TIMEOUT:"keyLoadTimeOut",BUFFER_ADD_CODEC_ERROR:"bufferAddCodecError",BUFFER_APPEND_ERROR:"bufferAppendError",BUFFER_APPENDING_ERROR:"bufferAppendingError",BUFFER_STALLED_ERROR:"bufferStalledError",BUFFER_FULL_ERROR:"bufferFullError",BUFFER_SEEK_OVER_HOLE:"bufferSeekOverHole",BUFFER_NUDGE_ON_STALL:"bufferNudgeOnStall",INTERNAL_EXCEPTION:"internalException"}},49: function(n,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=Math.pow(2,32)-1,r=function(){function n(){}return n.init=function(){var t,i,r,u,f;for(t in n.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},n.types)n.types.hasOwnProperty(t)&&(n.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);i=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]);r=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);n.HDLR_TYPES={video:i,audio:r};u=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]);f=new Uint8Array([0,0,0,0,0,0,0,0]);n.STTS=n.STSC=n.STCO=f;n.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]);n.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]);n.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]);n.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var e=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),s=new Uint8Array([0,0,0,1]);n.FTYP=n.box(n.types.ftyp,e,s,e,o);n.DINF=n.box(n.types.dinf,n.box(n.types.dref,u))},n.box=function(n){for(var r,u=Array.prototype.slice.call(arguments,1),t=8,i=u.length,f=i;i--;)t+=u[i].byteLength;for((r=new Uint8Array(t))[0]=t>>24&255,r[1]=t>>16&255,r[2]=t>>8&255,r[3]=255&t,r.set(n,4),i=0,t=8;i<f;i++)r.set(u[i],t),t+=u[i].byteLength;return r},n.hdlr=function(t){return n.box(n.types.hdlr,n.HDLR_TYPES[t])},n.mdat=function(t){return n.box(n.types.mdat,t)},n.mdhd=function(t,r){r*=t;var u=Math.floor(r/(i+1)),f=Math.floor(r%(i+1));return n.box(n.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,u>>24,u>>16&255,u>>8&255,255&u,f>>24,f>>16&255,f>>8&255,255&f,85,196,0,0]))},n.mdia=function(t){return n.box(n.types.mdia,n.mdhd(t.timescale,t.duration),n.hdlr(t.type),n.minf(t))},n.mfhd=function(t){return n.box(n.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))},n.minf=function(t){return"audio"===t.type?n.box(n.types.minf,n.box(n.types.smhd,n.SMHD),n.DINF,n.stbl(t)):n.box(n.types.minf,n.box(n.types.vmhd,n.VMHD),n.DINF,n.stbl(t))},n.moof=function(t,i,r){return n.box(n.types.moof,n.mfhd(t),n.traf(r,i))},n.moov=function(t){for(var i=t.length,r=[];i--;)r[i]=n.trak(t[i]);return n.box.apply(null,[n.types.moov,n.mvhd(t[0].timescale,t[0].duration)].concat(r).concat(n.mvex(t)))},n.mvex=function(t){for(var i=t.length,r=[];i--;)r[i]=n.trex(t[i]);return n.box.apply(null,[n.types.mvex].concat(r))},n.mvhd=function(t,r){r*=t;var u=Math.floor(r/(i+1)),f=Math.floor(r%(i+1)),e=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,u>>24,u>>16&255,u>>8&255,255&u,f>>24,f>>16&255,f>>8&255,255&f,0,1,0,0,1,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,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return n.box(n.types.mvhd,e)},n.sdtp=function(t){for(var r,u=t.samples||[],f=new Uint8Array(4+u.length),i=0;i<u.length;i++)r=u[i].flags,f[i+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return n.box(n.types.sdtp,f)},n.stbl=function(t){return n.box(n.types.stbl,n.stsd(t),n.box(n.types.stts,n.STTS),n.box(n.types.stsc,n.STSC),n.box(n.types.stsz,n.STSZ),n.box(n.types.stco,n.STCO))},n.avc1=function(t){for(var e,u,r=[],f=[],i=0;i<t.sps.length;i++)u=(e=t.sps[i]).byteLength,r.push(u>>>8&255),r.push(255&u),r=r.concat(Array.prototype.slice.call(e));for(i=0;i<t.pps.length;i++)u=(e=t.pps[i]).byteLength,f.push(u>>>8&255),f.push(255&u),f=f.concat(Array.prototype.slice.call(e));var l=n.box(n.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|t.sps.length].concat(r).concat([t.pps.length]).concat(f))),h=t.width,c=t.height,o=t.pixelRatio[0],s=t.pixelRatio[1];return n.box(n.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,h>>8&255,255&h,c>>8&255,255&c,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l,n.box(n.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),n.box(n.types.pasp,new Uint8Array([o>>24,o>>16&255,o>>8&255,255&o,s>>24,s>>16&255,s>>8&255,255&s])))},n.esds=function(n){var t=n.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(n.config).concat([6,1,2]))},n.mp4a=function(t){var i=t.samplerate;return n.box(n.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,i>>8&255,255&i,0,0]),n.box(n.types.esds,n.esds(t)))},n.mp3=function(t){var i=t.samplerate;return n.box(n.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,i>>8&255,255&i,0,0]))},n.stsd=function(t){return"audio"===t.type?t.isAAC||"mp3"!==t.codec?n.box(n.types.stsd,n.STSD,n.mp4a(t)):n.box(n.types.stsd,n.STSD,n.mp3(t)):n.box(n.types.stsd,n.STSD,n.avc1(t))},n.tkhd=function(t){var r=t.id,e=t.duration*t.timescale,o=t.width,s=t.height,u=Math.floor(e/(i+1)),f=Math.floor(e%(i+1));return n.box(n.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,u>>24,u>>16&255,u>>8&255,255&u,f>>24,f>>16&255,f>>8&255,255&f,0,0,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,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,o>>8&255,255&o,0,0,s>>8&255,255&s,0,0]))},n.traf=function(t,r){var o=n.sdtp(t),u=t.id,f=Math.floor(r/(i+1)),e=Math.floor(r%(i+1));return n.box(n.types.traf,n.box(n.types.tfhd,new Uint8Array([0,0,0,0,u>>24,u>>16&255,u>>8&255,255&u])),n.box(n.types.tfdt,new Uint8Array([1,0,0,0,f>>24,f>>16&255,f>>8&255,255&f,e>>24,e>>16&255,e>>8&255,255&e])),n.trun(t,o.length+16+20+8+16+8+8),o)},n.trak=function(t){return t.duration=t.duration||4294967295,n.box(n.types.trak,n.tkhd(t),n.mdia(t))},n.trex=function(t){var i=t.id;return n.box(n.types.trex,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},n.trun=function(t,i){var f,h,e,o,r,s,l=t.samples||[],u=l.length,a=12+16*u,c=new Uint8Array(a);for(i+=8+a,c.set([0,0,15,1,u>>>24&255,u>>>16&255,u>>>8&255,255&u,i>>>24&255,i>>>16&255,i>>>8&255,255&i],0),f=0;f<u;f++)e=(h=l[f]).duration,o=h.size,r=h.flags,s=h.cts,c.set([e>>>24&255,e>>>16&255,e>>>8&255,255&e,o>>>24&255,o>>>16&255,o>>>8&255,255&o,r.isLeading<<2|r.dependsOn,r.isDependedOn<<6|r.hasRedundancy<<4|r.paddingValue<<1|r.isNonSync,61440&r.degradPrio,15&r.degradPrio,s>>>24&255,s>>>16&255,s>>>8&255,255&s],12+16*f);return n.box(n.types.trun,c)},n.initSegment=function(t){n.types||n.init();var i,r=n.moov(t);return(i=new Uint8Array(n.FTYP.byteLength+r.byteLength)).set(n.FTYP),i.set(r,n.FTYP.byteLength),i},n}();t.default=r},48: function(n,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function n(){}return n.getSilentFrame=function(n,t){switch(n){case"mp4a.40.2":if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null},n}();t.default=i},46: function(n,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=i(11),f=i(0),u=i(23),e=function(){function n(n,t,i){this.observer=n;this.config=i;this.remuxer=t}return n.prototype.resetInitSegment=function(n,t,i,r){this._audioTrack={container:"audio/mpeg",type:"audio",id:-1,sequenceNumber:0,isAAC:!1,samples:[],len:0,manifestCodec:t,duration:r,inputTimeScale:9e4}},n.prototype.resetTimeStamp=function(){},n.probe=function(n){var t,e,i=r.default.getID3Data(n,0);if(i&&void 0!==r.default.getTimeStamp(i))for(t=i.length,e=Math.min(n.length-1,t+100);t<e;t++)if(u.default.probe(n,t))return f.logger.log("MPEG Audio sync word found !"),!0;return!1},n.prototype.append=function(n,t,i,f){for(var s,o=r.default.getID3Data(n,0),l=r.default.getTimeStamp(o),h=l?90*l:9e4*t,e=o.length,p=n.length,a=0,c=0,v=this._audioTrack,y=[{pts:h,dts:h,data:o}];e<p;)if(u.default.isHeader(n,e)){if(s=u.default.appendFrame(v,n,e,h,a),!s)break;e+=s.length;c=s.sample.pts;a++}else r.default.isHeader(n,e)?(o=r.default.getID3Data(n,e),y.push({pts:c,dts:c,data:o}),e+=o.length):e++;this.remuxer.remux(v,{samples:[]},{samples:y,inputTimeScale:9e4},{samples:[]},t,i,f)},n.prototype.destroy=function(){},n}();t.default=e},23: function(n,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={BitratesMap:[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],SamplingRateMap:[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],SamplesCoefficients:[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],BytesInSlot:[0,1,1,4],appendFrame:function(n,t,i,r,u){var f,e,o;if(!(i+24>t.length)&&(f=this.parseHeader(t,i),f&&i+f.frameLength<=t.length))return e=r+u*(9e4*f.samplesPerFrame/f.sampleRate),o={unit:t.subarray(i,i+f.frameLength),pts:e,dts:e},n.config=[],n.channelCount=f.channelCount,n.samplerate=f.sampleRate,n.samples.push(o),n.len+=f.frameLength,{sample:o,length:f.frameLength}},parseHeader:function(n,t){var r=n[t+1]>>3&3,u=n[t+1]>>1&3,f=n[t+2]>>4&15,e=n[t+2]>>2&3,c=n[t+2]>>1&1;if(1!==r&&0!==f&&15!==f&&3!==e){var l=3===r?3-u:3===u?3:4,a=1e3*i.BitratesMap[14*l+f-1],v=3===r?0:2===r?1:2,o=i.SamplingRateMap[3*v+e],y=n[t+3]>>6==3?1:2,s=i.SamplesCoefficients[r][u],h=i.BytesInSlot[u],p=8*s*h;return{sampleRate:o,channelCount:y,frameLength:parseInt(s*a/o+c,10)*h,samplesPerFrame:p}}},isHeaderPattern:function(n,t){return 255===n[t]&&224==(224&n[t+1])&&0!=(6&n[t+1])},isHeader:function(n,t){return!!(t+1<n.length&&this.isHeaderPattern(n,t))},probe:function(n,t){var i,u,r;return t+1<n.length&&this.isHeaderPattern(n,t)&&(i=this.parseHeader(n,t),u=4,i&&i.frameLength&&(u=i.frameLength),r=t+u,r===n.length||r+1<n.length&&this.isHeaderPattern(n,r))?!0:!1}};t.default=i},11: function(n,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function n(){}return n.isHeader=function(n,t){return t+10<=n.length&&73===n[t]&&68===n[t+1]&&51===n[t+2]&&n[t+3]<255&&n[t+4]<255&&n[t+6]<128&&n[t+7]<128&&n[t+8]<128&&n[t+9]<128},n.isFooter=function(n,t){return t+10<=n.length&&51===n[t]&&68===n[t+1]&&73===n[t+2]&&n[t+3]<255&&n[t+4]<255&&n[t+6]<128&&n[t+7]<128&&n[t+8]<128&&n[t+9]<128},n.getID3Data=function(t,i){for(var u=i,r=0;n.isHeader(t,i);)r+=10,r+=n._readSize(t,i+6),n.isFooter(t,i+10)&&(r+=10),i+=r;if(r>0)return t.subarray(u,u+r)},n._readSize=function(n,t){var i=0;return i=(127&n[t])<<21,i|=(127&n[t+1])<<14,i|=(127&n[t+2])<<7,i|127&n[t+3]},n.getTimeStamp=function(t){for(var u,r=n.getID3Frames(t),i=0;i<r.length;i++)if(u=r[i],n.isTimeStampFrame(u))return n._readTimeStamp(u)},n.isTimeStampFrame=function(n){return n&&"PRIV"===n.key&&"com.apple.streaming.transportStreamTimestamp"===n.info},n._getFrameData=function(t){var r=String.fromCharCode(t[0],t[1],t[2],t[3]),i=n._readSize(t,4);return{type:r,size:i,data:t.subarray(10,10+i)}},n.getID3Frames=function(t){for(var e,o,u,f,i=0,r=[];n.isHeader(t,i);){for(e=n._readSize(t,i+6),o=(i+=10)+e;i+8<o;)u=n._getFrameData(t.subarray(i)),f=n._decodeFrame(u),f&&r.push(f),i+=u.size+10;n.isFooter(t,i)&&(i+=10)}return r},n._decodeFrame=function(t){return"PRIV"===t.type?n._decodePrivFrame(t):"T"===t.type[0]?n._decodeTextFrame(t):"W"===t.type[0]?n._decodeURLFrame(t):void 0},n._readTimeStamp=function(n){if(8===n.data.byteLength){var t=new Uint8Array(n.data),r=1&t[3],i=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return i/=45,r&&(i+=47721858.84),Math.round(i)}},n._decodePrivFrame=function(t){if(!(t.size<2)){var i=n._utf8ArrayToStr(t.data,!0),r=new Uint8Array(t.data.subarray(i.length+1));return{key:t.type,info:i,data:r.buffer}}},n._decodeTextFrame=function(t){var i,r,u,f;if(!(t.size<2))return"TXXX"===t.type?(i=1,r=n._utf8ArrayToStr(t.data.subarray(i)),i+=r.length+1,u=n._utf8ArrayToStr(t.data.subarray(i)),{key:t.type,info:r,data:u}):(f=n._utf8ArrayToStr(t.data.subarray(1)),{key:t.type,data:f})},n._decodeURLFrame=function(t){var i,r,u,f;return"WXXX"===t.type?t.size<2?void 0:(i=1,r=n._utf8ArrayToStr(t.data.subarray(i)),i+=r.length+1,u=n._utf8ArrayToStr(t.data.subarray(i)),{key:t.type,info:r,data:u}):(f=n._utf8ArrayToStr(t.data),{key:t.type,data:f})},n._utf8ArrayToStr=function(n,t){void 0===t&&(t=!1);for(var i,f,e,o=n.length,r="",u=0;u<o;){if(0===(i=n[u++])&&t)return r;if(0!==i&&3!==i)switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:r+=String.fromCharCode(i);break;case 12:case 13:f=n[u++];r+=String.fromCharCode((31&i)<<6|63&f);break;case 14:f=n[u++];e=n[u++];r+=String.fromCharCode((15&i)<<12|(63&f)<<6|(63&e)<<0)}}return r},n}(),r=i._utf8ArrayToStr;t.utf8ArrayToStr=r;t.default=i},43: function(n,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var u=i(22),o=i(23),s=i(1),e=i(44),h=i(45),r=i(0),f=i(3),c={video:1,audio:2,id3:3,text:4},l=function(){function n(n,t,i,r){this.observer=n;this.config=i;this.typeSupported=r;this.remuxer=t;this.sampleAes=null}return n.prototype.setDecryptData=function(n){this.sampleAes=null!=n&&null!=n.key&&"SAMPLE-AES"===n.method?new h.default(this.observer,this.config,n,this.discardEPB):null},n.probe=function(t){var i=n._syncOffset(t);return!(i<0)&&(i&&r.logger.warn("MPEG2-TS detected but first sync word found @ offset "+i+", junk ahead ?"),!0)},n._syncOffset=function(n){for(var i=Math.min(1e3,n.length-564),t=0;t<i;){if(71===n[t]&&71===n[t+188]&&71===n[t+376])return t;t++}return-1},n.createTrack=function(n,t){return{container:"video"===n||"audio"===n?"video/mp2t":void 0,type:n,id:c[n],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],len:0,dropped:"video"===n?0:void 0,isAAC:"audio"===n||void 0,duration:"audio"===n?t:void 0}},n.prototype.resetInitSegment=function(t,i,r,u){this.pmtParsed=!1;this._pmtId=-1;this._avcTrack=n.createTrack("video",u);this._audioTrack=n.createTrack("audio",u);this._id3Track=n.createTrack("id3",u);this._txtTrack=n.createTrack("text",u);this.aacOverFlow=null;this.aacLastPTS=null;this.avcSample=null;this.audioCodec=i;this.videoCodec=r;this._duration=u},n.prototype.resetTimeStamp=function(){},n.prototype.append=function(t,i,u,e){var h,b,ft,c,o,g=t.length,nt=!1,d;this.contiguous=u;var et=this.pmtParsed,p=this._avcTrack,a=this._audioTrack,w=this._id3Track,tt=p.pid,it=a.pid,rt=w.pid,ot=this._pmtId,v=p.pesData,l=a.pesData,y=w.pesData,at=this._parsePAT,vt=this._parsePMT,k=this._parsePES,st=this._parseAVCPES.bind(this),ht=this._parseAACPES.bind(this),ct=this._parseMPEGPES.bind(this),lt=this._parseID3PES.bind(this),ut=n._syncOffset(t);for(g-=(g+ut)%188,h=ut;h<g;h+=188)if(71===t[h]){if(b=!!(64&t[h+1]),ft=((31&t[h+1])<<8)+t[h+2],(48&t[h+3])>>4>1){if((c=h+5+t[h+4])===h+188)continue}else c=h+4;switch(ft){case tt:b&&(v&&(o=k(v))&&void 0!==o.pts&&st(o,!1),v={data:[],size:0});v&&(v.data.push(t.subarray(c,h+188)),v.size+=h+188-c);break;case it:b&&(l&&(o=k(l))&&void 0!==o.pts&&(a.isAAC?ht(o):ct(o)),l={data:[],size:0});l&&(l.data.push(t.subarray(c,h+188)),l.size+=h+188-c);break;case rt:b&&(y&&(o=k(y))&&void 0!==o.pts&&lt(o),y={data:[],size:0});y&&(y.data.push(t.subarray(c,h+188)),y.size+=h+188-c);break;case 0:b&&(c+=t[c]+1);ot=this._pmtId=at(t,c);break;case ot:b&&(c+=t[c]+1);d=vt(t,c,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,null!=this.sampleAes);(tt=d.avc)>0&&(p.pid=tt);(it=d.audio)>0&&(a.pid=it,a.isAAC=d.isAAC);(rt=d.id3)>0&&(w.pid=rt);nt&&!et&&(r.logger.log("reparse from beginning"),nt=!1,h=ut-188);et=this.pmtParsed=!0;break;case 17:case 8191:break;default:nt=!0}}else this.observer.trigger(s.default.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});v&&(o=k(v))&&void 0!==o.pts?(st(o,!0),p.pesData=null):p.pesData=v;l&&(o=k(l))&&void 0!==o.pts?(a.isAAC?ht(o):ct(o),a.pesData=null):(l&&l.size&&r.logger.log("last AAC PES packet truncated,might overlap between fragments"),a.pesData=l);y&&(o=k(y))&&void 0!==o.pts?(lt(o),w.pesData=null):w.pesData=y;null==this.sampleAes?this.remuxer.remux(a,p,w,this._txtTrack,i,u,e):this.decryptAndRemux(a,p,w,this._txtTrack,i,u,e)},n.prototype.decryptAndRemux=function(n,t,i,r,u,f,e){if(n.samples&&n.isAAC){var o=this;this.sampleAes.decryptAacSamples(n.samples,0,function(){o.decryptAndRemuxAvc(n,t,i,r,u,f,e)})}else this.decryptAndRemuxAvc(n,t,i,r,u,f,e)},n.prototype.decryptAndRemuxAvc=function(n,t,i,r,u,f,e){if(t.samples){var o=this;this.sampleAes.decryptAvcSamples(t.samples,0,0,function(){o.remuxer.remux(n,t,i,r,u,f,e)})}else this.remuxer.remux(n,t,i,r,u,f,e)},n.prototype.destroy=function(){this._initPTS=this._initDTS=void 0;this._duration=0},n.prototype._parsePAT=function(n,t){return(31&n[t+10])<<8|n[t+11]},n.prototype._parsePMT=function(n,t,i,u){var o,e,f={audio:-1,avc:-1,id3:-1,isAAC:!0};for(o=t+3+((15&n[t+1])<<8|n[t+2])-4,t+=12+((15&n[t+10])<<8|n[t+11]);t<o;){switch(e=(31&n[t+1])<<8|n[t+2],n[t]){case 207:if(!u){r.logger.log("unkown stream type:"+n[t]);break}case 15:-1===f.audio&&(f.audio=e);break;case 21:-1===f.id3&&(f.id3=e);break;case 219:if(!u){r.logger.log("unkown stream type:"+n[t]);break}case 27:-1===f.avc&&(f.avc=e);break;case 3:case 4:i?-1===f.audio&&(f.audio=e,f.isAAC=!1):r.logger.log("MPEG audio found, not supported in this browser for now");break;case 36:r.logger.warn("HEVC stream type found, not supported for now");break;default:r.logger.log("unkown stream type:"+n[t])}t+=5+((15&n[t+3])<<8|n[t+4])}return f},n.prototype._parsePES=function(n){var t,a,o,v,l,f,e,u,y=0,i=n.data,h,c,p,s;if(!n||0===n.size)return null;for(;i[0].length<19&&i.length>1;)h=new Uint8Array(i[0].length+i[1].length),h.set(i[0]),h.set(i[1],i[0].length),i[0]=h,i.splice(1,1);if(1===((t=i[0])[0]<<16)+(t[1]<<8)+t[2]){if((o=(t[4]<<8)+t[5])&&o>n.size-6)return null;for(192&(a=t[7])&&((f=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2)>4294967295&&(f-=8589934592),64&a?((e=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)>4294967295&&(e-=8589934592),f-e>54e5&&(r.logger.warn(Math.round((f-e)/9e4)+"s delta between PTS and DTS, align them"),f=e)):e=f),u=(v=t[8])+9,n.size-=u,l=new Uint8Array(n.size),c=0,p=i.length;c<p;c++){if(s=(t=i[c]).byteLength,u){if(u>s){u-=s;continue}t=t.subarray(u);s-=u;u=0}l.set(t,y);y+=s}return o&&(o-=v+3),{data:l,pts:f,dts:e,len:o}}return null},n.prototype.pushAccesUnit=function(n,t){if(n.units.length&&n.frame){var i=t.samples,u=i.length;!this.config.forceKeyFrameOnDiscontinuity||!0===n.key||t.sps&&(u||this.contiguous)?(n.id=u,i.push(n)):t.dropped++}n.debug.length&&r.logger.log(n.pts+"/"+n.dts+":"+n.debug)},n.prototype._parseAVCPES=function(n,t){var r,o,f,s=this,u=this._avcTrack,l=this._parseAVCNALu(n.data),i=this.avcSample,a=!1,c=this.pushAccesUnit.bind(this),h=function(n,t,i,r){return{key:n,pts:t,dts:i,units:[],debug:r}};n.data=null;i&&l.length&&!u.audFound&&(c(i,u),i=this.avcSample=h(!1,n.pts,n.dts,""));l.forEach(function(t){var k,l,b,it,g,v;switch(t.type){case 1:o=!0;i||(i=s.avcSample=h(!0,n.pts,n.dts,""));i.frame=!0;k=t.data;a&&k.length>4&&(l=new e.default(k).readSliceType(),2!==l&&4!==l&&7!==l&&9!==l||(i.key=!0));break;case 5:o=!0;i||(i=s.avcSample=h(!0,n.pts,n.dts,""));i.key=!0;i.frame=!0;break;case 6:o=!0;(r=new e.default(s.discardEPB(t.data))).readUByte();for(var d=0,y=0,nt=!1,p=0;!nt&&r.bytesAvailable>1;){d=0;do d+=p=r.readUByte();while(255===p);y=0;do y+=p=r.readUByte();while(255===p);if(4===d&&0!==r.bytesAvailable){if((nt=!0,181===r.readUByte())&&49===r.readUShort()&&1195456820===r.readUInt()&&3===r.readUByte()){var tt=r.readUByte(),rt=31&tt,w=[tt,r.readUByte()];for(f=0;f<rt;f++)w.push(r.readUByte()),w.push(r.readUByte()),w.push(r.readUByte());s._insertSampleInOrder(s._txtTrack.samples,{type:3,pts:n.pts,bytes:w})}}else if(y<r.bytesAvailable)for(f=0;f<y;f++)r.readUByte()}break;case 7:if(o=!0,a=!0,!u.sps){for(b=(r=new e.default(t.data)).readSPS(),u.width=b.width,u.height=b.height,u.pixelRatio=b.pixelRatio,u.sps=[t.data],u.duration=s._duration,it=t.data.subarray(1,4),g="avc1.",f=0;f<3;f++)v=it[f].toString(16),v.length<2&&(v="0"+v),g+=v;u.codec=g}break;case 8:o=!0;u.pps||(u.pps=[t.data]);break;case 9:o=!1;u.audFound=!0;i&&c(i,u);i=s.avcSample=h(!1,n.pts,n.dts,"");break;case 12:o=!1;break;default:o=!1;i&&(i.debug+="unknown NAL "+t.type+" ")}i&&o&&i.units.push(t)});t&&i&&(c(i,u),this.avcSample=null)},n.prototype._insertSampleInOrder=function(n,t){var r=n.length,i;if(r>0){if(t.pts>=n[r-1].pts)n.push(t);else for(i=r-1;i>=0;i--)if(t.pts<n[i].pts){n.splice(i,0,t);break}}else n.push(t)},n.prototype._getLastNalUnit=function(){var r,n=this.avcSample,t,i;return n&&0!==n.units.length||(t=this._avcTrack.samples,n=t[t.length-1]),n&&(i=n.units,r=i[i.length-1]),r},n.prototype._parseAVCNALu=function(n){var e,c,o,s,r=0,l=n.byteLength,v=this._avcTrack,t=v.naluState||0,a=t,h=[],u=-1,i,f;for(-1===t&&(u=0,s=31&n[0],t=0,r=1);r<l;)(e=n[r++],t)?1!==t?e?1===e?(u>=0?(o={data:n.subarray(u,r-t-1),type:s},h.push(o)):(i=this._getLastNalUnit())&&(a&&r<=4-a&&i.state&&(i.data=i.data.subarray(0,i.data.byteLength-a)),(c=r-t-1)>0)&&((f=new Uint8Array(i.data.byteLength+c)).set(i.data,0),f.set(n.subarray(0,c),i.data.byteLength),i.data=f),r<l?(u=r,s=31&n[r],t=0):t=-1):t=0:t=3:t=e?0:2:t=e?0:1;return(u>=0&&t>=0&&(o={data:n.subarray(u,l),type:s,state:t},h.push(o)),0===h.length)&&(i=this._getLastNalUnit())&&((f=new Uint8Array(i.data.byteLength+n.byteLength)).set(i.data,0),f.set(n,i.data.byteLength),i.data=f),v.naluState=t,h},n.prototype.discardEPB=function(n){for(var r,u,f,e=n.byteLength,i=[],t=1;t<e-2;)0===n[t]&&0===n[t+1]&&3===n[t+2]?(i.push(t+2),t+=2):t++;if(0===i.length)return n;for(u=e-i.length,f=new Uint8Array(u),r=0,t=0;t<u;r++,t++)r===i[0]&&(r++,i.shift()),f[t]=n[r];return f},n.prototype._parseAACPES=function(n){var b,p,t,k,e,w=this._audioTrack,i=n.data,l=n.pts,o=this.aacOverFlow,d=this.aacLastPTS,a,h,c,v,y;for(o&&(a=new Uint8Array(o.byteLength+i.byteLength),a.set(o,0),a.set(i,o.byteLength),i=a),t=0,e=i.length;t<e-1&&!u.isHeader(i,t);t++);if(!t||(h=void 0,c=void 0,t<e-1?(h="AAC PES did not start with ADTS header,offset:"+t,c=!1):(h="no ADTS header found in AAC PES",c=!0),r.logger.warn("parsing error:"+h),this.observer.trigger(s.default.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.FRAG_PARSING_ERROR,fatal:c,reason:h}),!c)){for((u.initTrackConfig(w,this.observer,i,t,this.audioCodec),p=0,b=u.getFrameDuration(w.samplerate),o&&d)&&(v=d+b,Math.abs(v-l)>1&&(r.logger.log("AAC: align PTS for overlapping frames by "+Math.round((v-l)/90)),l=v));t<e;)if(u.isHeader(i,t)&&t+5<e){if(y=u.appendFrame(w,i,t,l,p),!y)break;t+=y.length;k=y.sample.pts;p++}else t++;o=t<e?i.subarray(t,e):null;this.aacOverFlow=o;this.aacLastPTS=k}},n.prototype._parseMPEGPES=function(n){for(var r,i=n.data,f=i.length,u=0,t=0,e=n.pts;t<f;)if(o.default.isHeader(i,t)){if(r=o.default.appendFrame(this._audioTrack,i,t,e,u),!r)break;t+=r.length;u++}else t++},n.prototype._parseID3PES=function(n){this._id3Track.samples.push(n)},n}();t.default=l},45: function(n,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=i(13),u=function(){function n(n,t,i,u){this.decryptdata=i;this.discardEPB=u;this.decrypter=new r.default(n,t,{removePKCS7Padding:!1})}return n.prototype.decryptBuffer=function(n,t){this.decrypter.decrypt(n,this.decryptdata.key.buffer,this.decryptdata.iv.buffer,t)},n.prototype.decryptAacSample=function(n,t,i,r){var u=n[t].unit,f=u.subarray(16,u.length-u.length%16),e=f.buffer.slice(f.byteOffset,f.byteOffset+f.length),o=this;this.decryptBuffer(e,function(f){f=new Uint8Array(f);u.set(f,16);r||o.decryptAacSamples(n,t+1,i)})},n.prototype.decryptAacSamples=function(n,t,i){for(;;t++){if(t>=n.length)return void i();if(!(n[t].unit.length<32)){var r=this.decrypter.isSync();if(this.decryptAacSample(n,t,i,r),!r)return}}},n.prototype.getAvcEncryptedData=function(n){for(var u=16*Math.floor((n.length-48)/160)+16,i=new Int8Array(u),r=0,t=32;t<=n.length-16;t+=160,r+=16)i.set(n.subarray(t,t+16),r);return i},n.prototype.getAvcDecryptedUnit=function(n,t){t=new Uint8Array(t);for(var i=0,r=32;r<=n.length-16;r+=160,i+=16)n.set(t.subarray(i,i+16),r);return n},n.prototype.decryptAvcSample=function(n,t,i,r,u,f){var e=this.discardEPB(u.data),s=this.getAvcEncryptedData(e),o=this;this.decryptBuffer(s.buffer,function(s){u.data=o.getAvcDecryptedUnit(e,s);f||o.decryptAvcSamples(n,t,i+1,r)})},n.prototype.decryptAvcSamples=function(n,t,i,r){for(var f,u,e;;t++,i=0){if(t>=n.length)return void r();for(f=n[t].units;!(i>=f.length);i++)if(u=f[i],!(u.length<=48||1!==u.type&&5!==u.type)&&(e=this.decrypter.isSync(),this.decryptAvcSample(n,t,i,r,u,e),!e))return}},n}();t.default=u},13: function(n,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var f=i(39),e=i(40),o=i(41),u=i(3),r=i(0),s=i(1),h=i(6).getSelfScope(),c=function(){function n(n,t,i){var u=(void 0===i?{}:i).removePKCS7Padding,f=void 0===u||u,r;if(this.logEnabled=!0,this.observer=n,this.config=t,this.removePKCS7Padding=f,f)try{r=h.crypto;r&&(this.subtle=r.subtle||r.webkitSubtle)}catch(n){}this.disableWebCrypto=!this.subtle}return n.prototype.isSync=function(){return this.disableWebCrypto&&this.config.enableSoftwareAES},n.prototype.decrypt=function(n,t,i,u){var c=this,s,h;this.disableWebCrypto&&this.config.enableSoftwareAES?(this.logEnabled&&(r.logger.log("JS AES decrypt"),this.logEnabled=!1),s=this.decryptor,s||(this.decryptor=s=new o.default),s.expandKey(t),u(s.decrypt(n,0,i,this.removePKCS7Padding))):(this.logEnabled&&(r.logger.log("WebCrypto AES decrypt"),this.logEnabled=!1),h=this.subtle,this.key!==t&&(this.key=t,this.fastAesKey=new e.default(h,t)),this.fastAesKey.expandKey().then(function(r){new f.default(h,i).decrypt(n,r).catch(function(r){c.onWebCryptoError(r,n,t,i,u)}).then(function(n){u(n)})}).catch(function(r){c.onWebCryptoError(r,n,t,i,u)}))},n.prototype.onWebCryptoError=function(n,t,i,f,e){this.config.enableSoftwareAES?(r.logger.log("WebCrypto Error, disable WebCrypto API"),this.disableWebCrypto=!0,this.logEnabled=!0,this.decrypt(t,i,f,e)):(r.logger.error("decrypting error : "+n.message),this.observer.trigger(s.default.ERROR,{type:u.ErrorTypes.MEDIA_ERROR,details:u.ErrorDetails.FRAG_DECRYPT_ERROR,fatal:!0,reason:n.message}))},n.prototype.destroy=function(){var n=this.decryptor;n&&(n.destroy(),this.decryptor=void 0)},n}();t.default=c},41: function(n,t){"use strict";function i(n){var t=n.byteLength,i=t&&new DataView(n).getUint8(t-1);return i?n.slice(0,t-i):n}Object.defineProperty(t,"__esModule",{value:!0});t.removePadding=i;var r=function(){function n(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54];this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)];this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)];this.sBox=new Uint32Array(256);this.invSBox=new Uint32Array(256);this.key=new Uint32Array(0);this.initTable()}return n.prototype.uint8ArrayToUint32Array_=function(n){for(var r=new DataView(n),i=new Uint32Array(4),t=0;t<4;t++)i[t]=r.getUint32(4*t);return i},n.prototype.initTable=function(){for(var l=this.sBox,a=this.invSBox,e=this.subMix,v=e[0],y=e[1],p=e[2],w=e[3],o=this.invSubMix,b=o[0],k=o[1],d=o[2],g=o[3],r=new Uint32Array(256),i=0,f=0,u=0,t,u=0;u<256;u++)r[u]=u<128?u<<1:u<<1^283;for(u=0;u<256;u++){t=f^f<<1^f<<2^f<<3^f<<4;t=t>>>8^255&t^99;l[i]=t;a[t]=i;var s=r[i],h=r[s],c=r[h],n=257*r[t]^16843008*t;v[i]=n<<24|n>>>8;y[i]=n<<16|n>>>16;p[i]=n<<8|n>>>24;w[i]=n;n=16843009*c^65537*h^257*s^16843008*i;b[t]=n<<24|n>>>8;k[t]=n<<16|n>>>16;d[t]=n<<8|n>>>24;g[t]=n;i?(i=s^r[r[r[c^s]]],f^=r[r[f]]):i=f=1}},n.prototype.expandKey=function(n){for(var r,e=this.uint8ArrayToUint32Array_(n),l=!0,h=0;h<e.length&&l;)l=e[h]===this.key[h],h++;if(!l){if(this.key=e,r=this.keySize=e.length,4!==r&&6!==r&&8!==r)throw new Error("Invalid aes key size="+r);for(var f,a,t,o=this.ksRows=4*(r+6+1),s=this.keySchedule=new Uint32Array(o),v=this.invKeySchedule=new Uint32Array(o),u=this.sBox,y=this.rcon,c=this.invSubMix,p=c[0],w=c[1],b=c[2],k=c[3],i=0;i<o;i++)i<r?a=s[i]=e[i]:(t=a,i%r==0?(t=u[(t=t<<8|t>>>24)>>>24]<<24|u[t>>>16&255]<<16|u[t>>>8&255]<<8|u[255&t],t^=y[i/r|0]<<24):r>6&&i%r==4&&(t=u[t>>>24]<<24|u[t>>>16&255]<<16|u[t>>>8&255]<<8|u[255&t]),s[i]=a=(s[i-r]^t)>>>0);for(f=0;f<o;f++)i=o-f,t=3&f?s[i]:s[i-4],v[f]=f<4||i<=4?t:p[u[t>>>24]]^w[u[t>>>16&255]]^b[u[t>>>8&255]]^k[u[255&t]],v[f]=v[f]>>>0}},n.prototype.networkToHostOrderSwap=function(n){return n<<24|(65280&n)<<8|(16711680&n)>>8|n>>>24},n.prototype.decrypt=function(n,t,r,u){for(var p,w,b,k,s,h,c,l,ut,ft,et,ot,o,st,vt=this.keySize+6,e=this.invKeySchedule,f=this.invSBox,d=this.invSubMix,g=d[0],nt=d[1],tt=d[2],it=d[3],rt=this.uint8ArrayToUint32Array_(r),ht=rt[0],ct=rt[1],lt=rt[2],at=rt[3],v=new Int32Array(n),y=new Int32Array(v.length),a=this.networkToHostOrderSwap;t<v.length;){for(ut=a(v[t]),ft=a(v[t+1]),et=a(v[t+2]),ot=a(v[t+3]),s=ut^e[0],h=ot^e[1],c=et^e[2],l=ft^e[3],o=4,st=1;st<vt;st++)p=g[s>>>24]^nt[h>>16&255]^tt[c>>8&255]^it[255&l]^e[o],w=g[h>>>24]^nt[c>>16&255]^tt[l>>8&255]^it[255&s]^e[o+1],b=g[c>>>24]^nt[l>>16&255]^tt[s>>8&255]^it[255&h]^e[o+2],k=g[l>>>24]^nt[s>>16&255]^tt[h>>8&255]^it[255&c]^e[o+3],s=p,h=w,c=b,l=k,o+=4;p=f[s>>>24]<<24^f[h>>16&255]<<16^f[c>>8&255]<<8^f[255&l]^e[o];w=f[h>>>24]<<24^f[c>>16&255]<<16^f[l>>8&255]<<8^f[255&s]^e[o+1];b=f[c>>>24]<<24^f[l>>16&255]<<16^f[s>>8&255]<<8^f[255&h]^e[o+2];k=f[l>>>24]<<24^f[s>>16&255]<<16^f[h>>8&255]<<8^f[255&c]^e[o+3];o+=3;y[t]=a(p^ht);y[t+1]=a(k^ct);y[t+2]=a(b^lt);y[t+3]=a(w^at);ht=ut;ct=ft;lt=et;at=ot;t+=4}return u?i(y.buffer):y.buffer},n.prototype.destroy=function(){this.key=void 0;this.keySize=void 0;this.ksRows=void 0;this.sBox=void 0;this.invSBox=void 0;this.subMix=void 0;this.invSubMix=void 0;this.keySchedule=void 0;this.invKeySchedule=void 0;this.rcon=void 0},n}();t.default=r},40: function(n,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function n(n,t){this.subtle=n;this.key=t}return n.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},n}();t.default=i},39: function(n,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function n(n,t){this.subtle=n;this.aesIV=t}return n.prototype.decrypt=function(n,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,n)},n}();t.default=i},44: function(n,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=i(0),u=function(){function n(n){this.data=n;this.bytesAvailable=n.byteLength;this.word=0;this.bitsAvailable=0}return n.prototype.loadWord=function(){var t=this.data,i=this.bytesAvailable,r=t.byteLength-i,u=new Uint8Array(4),n=Math.min(4,i);if(0===n)throw new Error("no bytes available");u.set(t.subarray(r,r+n));this.word=new DataView(u.buffer).getUint32(0);this.bitsAvailable=8*n;this.bytesAvailable-=n},n.prototype.skipBits=function(n){var t;this.bitsAvailable>n?(this.word<<=n,this.bitsAvailable-=n):(n-=this.bitsAvailable,n-=(t=n>>3)>>3,this.bytesAvailable-=t,this.loadWord(),this.word<<=n,this.bitsAvailable-=n)},n.prototype.readBits=function(n){var t=Math.min(this.bitsAvailable,n),i=this.word>>>32-t;return n>32&&r.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0?this.word<<=t:this.bytesAvailable>0&&this.loadWord(),(t=n-t)>0&&this.bitsAvailable?i<<t|this.readBits(t):i},n.prototype.skipLZ=function(){for(var n=0;n<this.bitsAvailable;++n)if(0!=(this.word&2147483648>>>n))return this.word<<=n,this.bitsAvailable-=n,n;return this.loadWord(),n+this.skipLZ()},n.prototype.skipUEG=function(){this.skipBits(1+this.skipLZ())},n.prototype.skipEG=function(){this.skipBits(1+this.skipLZ())},n.prototype.readUEG=function(){var n=this.skipLZ();return this.readBits(n+1)-1},n.prototype.readEG=function(){var n=this.readUEG();return 1&n?1+n>>>1:-1*(n>>>1)},n.prototype.readBoolean=function(){return 1===this.readBits(1)},n.prototype.readUByte=function(){return this.readBits(8)},n.prototype.readUShort=function(){return this.readBits(16)},n.prototype.readUInt=function(){return this.readBits(32)},n.prototype.skipScalingList=function(n){for(var r=8,t=8,i=0;i<n;i++)0!==t&&(t=(r+this.readEG()+256)%256),r=0===t?r:t},n.prototype.readSPS=function(){var t,a,v,y,s,p,u,w=0,b=0,k=0,d=0,r=this.readUByte.bind(this),g=this.readBits.bind(this),i=this.readUEG.bind(this),e=this.readBoolean.bind(this),f=this.skipBits.bind(this),h=this.skipEG.bind(this),o=this.skipUEG.bind(this),nt=this.skipScalingList.bind(this),c,l,n;if((r(),t=r(),g(5),f(3),r(),o(),100===t||110===t||122===t||244===t||44===t||83===t||86===t||118===t||128===t)&&(c=i(),3===c&&f(1),o(),o(),f(1),e()))for(p=3!==c?8:12,u=0;u<p;u++)e()&&nt(u<6?16:64);if(o(),l=i(),0===l)i();else if(1===l)for(f(1),h(),h(),a=i(),u=0;u<a;u++)h();if(o(),f(1),v=i(),y=i(),0===(s=g(1))&&f(1),f(1),e()&&(w=i(),b=i(),k=i(),d=i()),n=[1,1],e()&&e())switch(r()){case 1:n=[1,1];break;case 2:n=[12,11];break;case 3:n=[10,11];break;case 4:n=[16,11];break;case 5:n=[40,33];break;case 6:n=[24,11];break;case 7:n=[20,11];break;case 8:n=[32,11];break;case 9:n=[80,33];break;case 10:n=[18,11];break;case 11:n=[15,11];break;case 12:n=[64,33];break;case 13:n=[160,99];break;case 14:n=[4,3];break;case 15:n=[3,2];break;case 16:n=[2,1];break;case 255:n=[r()<<8|r(),r()<<8|r()]}return{width:Math.ceil(16*(v+1)-2*w-2*b),height:(2-s)*(y+1)*16-(s?2:4)*(k+d),pixelRatio:n}},n.prototype.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},n}();t.default=u},22: function(n,t,i){"use strict";function s(n,t,i,r){var s,u,h,c,f,a=navigator.userAgent.toLowerCase(),y=r,v=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];if(s=1+((192&t[i+2])>>>6),!((u=(60&t[i+2])>>>2)>v.length-1))return c=(1&t[i+2])<<2,c|=(192&t[i+3])>>>6,e.logger.log("manifest codec:"+r+",ADTS data:type:"+s+",sampleingIndex:"+u+"["+v[u]+"Hz],channelConfig:"+c),/firefox/i.test(a)?u>=6?(s=5,f=new Array(4),h=u-3):(s=2,f=new Array(2),h=u):-1!==a.indexOf("android")?(s=2,f=new Array(2),h=u):(s=5,f=new Array(4),r&&(-1!==r.indexOf("mp4a.40.29")||-1!==r.indexOf("mp4a.40.5"))||!r&&u>=6?h=u-3:((r&&-1!==r.indexOf("mp4a.40.2")&&(u>=6&&1===c||/vivaldi/i.test(a))||!r&&1===c)&&(s=2,f=new Array(2)),h=u)),f[0]=s<<3,f[0]|=(14&u)>>1,f[1]|=(1&u)<<7,f[1]|=c<<3,5===s&&(f[1]|=(14&h)>>1,f[2]=(1&h)<<7,f[2]|=8,f[3]=0),{config:f,samplerate:v[u],channelCount:c,codec:"mp4a.40."+s,manifestCodec:y};n.trigger(l.default.ERROR,{type:o.ErrorTypes.MEDIA_ERROR,details:o.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+u})}function r(n,t){return 255===n[t]&&240==(246&n[t+1])}function u(n,t){return 1&n[t+1]?7:9}function f(n,t){return(3&n[t+3])<<11|n[t+4]<<3|(224&n[t+5])>>>5}function h(n){return 9216e4/n}function c(n,t,i,r,e){var o,s,h=n.length;if(o=u(n,t),s=f(n,t),(s-=o)>0&&t+o+s<=h)return{headerLength:o,frameLength:s,stamp:i+r*e}}Object.defineProperty(t,"__esModule",{value:!0});var e=i(0),o=i(3),l=i(1);t.getAudioConfig=s;t.isHeaderPattern=r;t.getHeaderLength=u;t.getFullFrameLength=f;t.isHeader=function(n,t){return!!(t+1<n.length&&r(n,t))};t.probe=function(n,t){var e,i;return t+1<n.length&&r(n,t)&&(e=u(n,t),t+5<n.length&&(e=f(n,t)),i=t+e,i===n.length||i+1<n.length&&r(n,i))?!0:!1};t.initTrackConfig=function(n,t,i,r,u){if(!n.samplerate){var f=s(t,i,r,u);n.config=f.config;n.samplerate=f.samplerate;n.channelCount=f.channelCount;n.codec=f.codec;n.manifestCodec=f.manifestCodec;e.logger.log("parsed codec:"+n.codec+",rate:"+f.samplerate+",nb channel:"+f.channelCount)}};t.getFrameDuration=h;t.parseFrameHeader=c;t.appendFrame=function(n,t,i,r,u){var f=c(t,i,r,u,h(n.samplerate));if(f){var s=f.stamp,e=f.headerLength,o=f.frameLength,l={unit:t.subarray(i+e,i+e+o),pts:s,dts:s};return n.samples.push(l),n.len+=o,{sample:l,length:o+e}}}},17: function(n,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var f=i(0),r=i(1),u=Math.pow(2,32)-1,e=function(){function n(n,t){this.observer=n;this.remuxer=t}return n.prototype.resetTimeStamp=function(n){this.initPTS=n},n.prototype.resetInitSegment=function(t,i,u,f){var e,o;t&&t.byteLength?(e=this.initData=n.parseInitSegment(t),null==i&&(i="mp4a.40.5"),null==u&&(u="avc1.42e01e"),o={},e.audio&&e.video?o.audiovideo={container:"video/mp4",codec:i+","+u,initSegment:f?t:null}:(e.audio&&(o.audio={container:"audio/mp4",codec:i,initSegment:f?t:null}),e.video&&(o.video={container:"video/mp4",codec:u,initSegment:f?t:null})),this.observer.trigger(r.default.FRAG_PARSING_INIT_SEGMENT,{tracks:o})):(i&&(this.audioCodec=i),u&&(this.videoCodec=u))},n.probe=function(t){return n.findBox({data:t,start:0,end:Math.min(t.length,16384)},["moof"]).length>0},n.bin2str=function(n){return String.fromCharCode.apply(null,n)},n.readUint16=function(n,t){n.data&&(t+=n.start,n=n.data);var i=n[t]<<8|n[t+1];return i<0?65536+i:i},n.readUint32=function(n,t){n.data&&(t+=n.start,n=n.data);var i=n[t]<<24|n[t+1]<<16|n[t+2]<<8|n[t+3];return i<0?4294967296+i:i},n.writeUint32=function(n,t,i){n.data&&(t+=n.start,n=n.data);n[t]=i>>24;n[t+1]=i>>16&255;n[t+2]=i>>8&255;n[t+3]=255&i},n.findBox=function(t,i){var r,o,h,u,c,s,f,e=[];if(t.data?(s=t.start,u=t.end,t=t.data):(s=0,u=t.byteLength),!i.length)return null;for(r=s;r<u;)o=n.readUint32(t,r),h=n.bin2str(t.subarray(r+4,r+8)),f=o>1?r+o:u,h===i[0]&&(1===i.length?e.push({data:t,start:r+8,end:f}):(c=n.findBox({data:t,start:r+8,end:f},i.slice(1))).length&&(e=e.concat(c))),r=f;return e},n.parseSegmentIndex=function(t){var s,y=n.findBox(t,["moov"])[0],p=y?y.end:null,i=0,r=n.findBox(t,["sidx"]),f,h,e,c,l,u,a,o,v;if(!r||!r[0])return null;for(s=[],f=(r=r[0]).data[0],i=0===f?8:16,h=n.readUint32(r,i),i+=4,i+=0===f?8:16,i+=2,e=r.end+0,c=n.readUint16(r,i),i+=2,l=0;l<c;l++){if(u=i,a=n.readUint32(r,u),u+=4,o=2147483647&a,1==(2147483648&a)>>>31)return void console.warn("SIDX has hierarchical references (not supported)");v=n.readUint32(r,u);u+=4;s.push({referenceSize:o,subsegmentDuration:v,info:{duration:v/h,start:e,end:e+o-1}});e+=o;i=u+=4}return{earliestPresentationTime:0,timescale:h,version:f,referencesCount:c,references:s,moovEndOffset:p}},n.parseInitSegment=function(t){var i=[];return n.findBox(t,["moov","trak"]).forEach(function(t){var o=n.findBox(t,["tkhd"])[0],c,u,e,r,v;if(o){var l=o.data[o.start],h=0===l?12:20,a=n.readUint32(o,h),s=n.findBox(t,["mdia","mdhd"])[0];s&&(h=0===(l=s.data[s.start])?12:20,c=n.readUint32(s,h),u=n.findBox(t,["mdia","hdlr"])[0],u&&(e={soun:"audio",vide:"video"}[n.bin2str(u.data.subarray(u.start+8,u.start+12))],e&&(r=n.findBox(t,["mdia","minf","stbl","stsd"]),r.length&&(r=r[0],v=n.bin2str(r.data.subarray(r.start+12,r.start+16)),f.logger.log("MP4Demuxer:"+e+":"+v+" found")),i[a]={timescale:c,type:e},i[e]={timescale:c,id:a})))}}),i},n.getStartDTS=function(t,i){var u,f,r;return u=n.findBox(i,["moof","traf"]),f=[].concat.apply([],u.map(function(i){return n.findBox(i,["tfhd"]).map(function(r){var u,f;return u=n.readUint32(r,4),f=t[u].timescale||9e4,n.findBox(i,["tfdt"]).map(function(t){var r,i;return r=t.data[t.start],i=n.readUint32(t,4),1===r&&(i*=Math.pow(2,32),i+=n.readUint32(t,8)),i})[0]/f})})),r=Math.min.apply(null,f),isFinite(r)?r:0},n.offsetStartDTS=function(t,i,r){n.findBox(i,["moof","traf"]).map(function(i){return n.findBox(i,["tfhd"]).map(function(f){var o=n.readUint32(f,4),e=t[o].timescale||9e4;n.findBox(i,["tfdt"]).map(function(t){var s=t.data[t.start],i=n.readUint32(t,4),f,o;0===s?n.writeUint32(t,4,i-r*e):(i*=Math.pow(2,32),i+=n.readUint32(t,8),i-=r*e,i=Math.max(i,0),f=Math.floor(i/(u+1)),o=Math.floor(i%(u+1)),n.writeUint32(t,4,f),n.writeUint32(t,8,o))})})})},n.prototype.append=function(t,i,u,f){var e=this.initData,s,o,h;e||(this.resetInitSegment(t,this.audioCodec,this.videoCodec,!1),e=this.initData);o=this.initPTS;void 0===o&&(h=n.getStartDTS(e,t),this.initPTS=o=h-i,this.observer.trigger(r.default.INIT_PTS_FOUND,{initPTS:o}));n.offsetStartDTS(e,t,o);s=n.getStartDTS(e,t);this.remuxer.remux(e.audio,e.video,null,null,s,u,f,t)},n.prototype.destroy=function(){},n}();t.default=e},42: function(n,t,i){"use strict";(function(n){Object.defineProperty(t,"__esModule",{value:!0});var u=i(22),f=i(0),r=i(11),e=function(){function t(n,t,i){this.observer=n;this.config=i;this.remuxer=t}return t.prototype.resetInitSegment=function(n,t,i,r){this._audioTrack={container:"audio/adts",type:"audio",id:0,sequenceNumber:0,isAAC:!0,samples:[],len:0,manifestCodec:t,duration:r,inputTimeScale:9e4}},t.prototype.resetTimeStamp=function(){},t.probe=function(n){if(!n)return!1;for(var t=(r.default.getID3Data(n,0)||[]).length,i=n.length;t<i;t++)if(u.probe(n,t))return f.logger.log("ADTS sync word found !"),!0;return!1},t.prototype.append=function(t,i,e,o){for(var a,l=this._audioTrack,h=r.default.getID3Data(t,0)||[],v=r.default.getTimeStamp(h),y=n.isFinite(v)?90*v:9e4*i,p=0,c=y,w=t.length,s=h.length,b=[{pts:c,dts:c,data:h}];s<w-1;)if(u.isHeader(t,s)&&s+5<w){if(u.initTrackConfig(l,this.observer,t,s,l.manifestCodec),a=u.appendFrame(l,t,s,y,p),!a){f.logger.log("Unable to parse AAC frame");break}s+=a.length;c=a.sample.pts;p++}else r.default.isHeader(t,s)?(h=r.default.getID3Data(t,s),b.push({pts:c,dts:c,data:h}),s+=h.length):s++;this.remuxer.remux(l,{samples:[]},{samples:b,inputTimeScale:9e4},{samples:[]},i,e,o)},t.prototype.destroy=function(){},t}();t.default=e}).call(this,i(2).Number)},2: function(n,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=i(6).getSelfScope().Number;t.Number=r;r.isFinite=r.isFinite||function(n){return"number"==typeof n&&isFinite(n)}}}))(self);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement