yanchengPowerSupply/node_modules/mux.js/dist/mux.min.js

3 lines
80 KiB
JavaScript

!function t(e,i,n){function a(s,o){if(!i[s]){if(!e[s]){var h="function"==typeof require&&require;if(!o&&h)return h(s,!0);if(r)return r(s,!0);var d=new Error("Cannot find module '"+s+"'");throw d.code="MODULE_NOT_FOUND",d}var p=i[s]={exports:{}};e[s][0].call(p.exports,function(t){var i=e[s][1][t];return a(i||t)},p,p.exports,t,e,i,n)}return i[s].exports}for(var r="function"==typeof require&&require,s=0;s<n.length;s++)a(n[s]);return a}({1:[function(t,e,i){"use strict";var n,a=t(30);n=function(){var t=new Uint8Array,e=0;n.prototype.init.call(this),this.setTimestamp=function(t){e=t},this.parseId3TagSize=function(t,e){var i=t[e+6]<<21|t[e+7]<<14|t[e+8]<<7|t[e+9];return(16&t[e+5])>>4?i+20:i+10},this.parseAdtsSize=function(t,e){var i=(224&t[e+5])>>5,n=t[e+4]<<3;return 6144&t[e+3]|n|i},this.push=function(i){var n,a,r,s,o=0,h=0;for(t.length?(s=t.length,t=new Uint8Array(i.byteLength+s),t.set(t.subarray(0,s)),t.set(i,s)):t=i;t.length-h>=3;)if(t[h]!=="I".charCodeAt(0)||t[h+1]!=="D".charCodeAt(0)||t[h+2]!=="3".charCodeAt(0))if(!0&t[h]&&240==(240&t[h+1])){if(t.length-h<7)break;if((o=this.parseAdtsSize(t,h))>t.length)break;r={type:"audio",data:t.subarray(h,h+o),pts:e,dts:e},this.trigger("data",r),h+=o}else h++;else{if(t.length-h<10)break;if((o=this.parseId3TagSize(t,h))>t.length)break;a={type:"timed-metadata",data:t.subarray(h,h+o)},this.trigger("data",a),h+=o}n=t.length-h,t=n>0?t.subarray(h):new Uint8Array}},n.prototype=new a,e.exports=n},{}],2:[function(t,e,i){"use strict";var n=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],a=function(t){return t[0]<<21|t[1]<<14|t[2]<<7|t[3]},r=function(t,e,i){var n,a="";for(n=e;n<i;n++)a+="%"+("00"+t[n].toString(16)).slice(-2);return a},s=function(t,e,i){return unescape(r(t,e,i))},o=function(t,e){var i=t[e+6]<<21|t[e+7]<<14|t[e+8]<<7|t[e+9];return(16&t[e+5])>>4?i+20:i+10},h=function(t,e){var i=(224&t[e+5])>>5,n=t[e+4]<<3;return 6144&t[e+3]|n|i},d=function(t,e){return t[e]==="I".charCodeAt(0)&&t[e+1]==="D".charCodeAt(0)&&t[e+2]==="3".charCodeAt(0)?"timed-metadata":!0&t[e]&&240==(240&t[e+1])?"audio":null},p=function(t){for(var e=0;e+5<t.length;){if(255===t[e]&&240==(246&t[e+1]))return n[(60&t[e+2])>>>2];e++}return null},u=function(t){var e,i,n;e=10,64&t[5]&&(e+=4,e+=a(t.subarray(10,14)));do{if((i=a(t.subarray(e+4,e+8)))<1)return null;if("PRIV"===String.fromCharCode(t[e],t[e+1],t[e+2],t[e+3])){n=t.subarray(e+10,e+i+10);for(var r=0;r<n.byteLength;r++)if(0===n[r]){var o=s(n,0,r);if("com.apple.streaming.transportStreamTimestamp"===o){var h=n.subarray(r+1),d=(1&h[3])<<30|h[4]<<22|h[5]<<14|h[6]<<6|h[7]>>>2;return d*=4,d+=3&h[7]}break}}e+=10,e+=i}while(e<t.byteLength);return null};e.exports={parseId3TagSize:o,parseAdtsSize:h,parseType:d,parseSampleRate:p,parseAacTimestamp:u}},{}],3:[function(t,e,i){"use strict";var n,a=t(30),r=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];n=function(){var t;n.prototype.init.call(this),this.push=function(e){var i,n,a,s,o,h,d=0,p=0;if("audio"===e.type)for(t?(s=t,t=new Uint8Array(s.byteLength+e.data.byteLength),t.set(s),t.set(e.data,s.byteLength)):t=e.data;d+5<t.length;)if(255===t[d]&&240==(246&t[d+1])){if(n=2*(1&~t[d+1]),i=(3&t[d+3])<<11|t[d+4]<<3|(224&t[d+5])>>5,o=1024*(1+(3&t[d+6])),h=9e4*o/r[(60&t[d+2])>>>2],a=d+i,t.byteLength<a)return;if(this.trigger("data",{pts:e.pts+p*h,dts:e.dts+p*h,sampleCount:o,audioobjecttype:1+(t[d+2]>>>6&3),channelcount:(1&t[d+2])<<2|(192&t[d+3])>>>6,samplerate:r[(60&t[d+2])>>>2],samplingfrequencyindex:(60&t[d+2])>>>2,samplesize:16,data:t.subarray(d+7+n,a)}),t.byteLength===a)return void(t=void 0);p++,t=t.subarray(a)}else d++},this.flush=function(){this.trigger("done")}},n.prototype=new a,e.exports=n},{}],4:[function(t,e,i){"use strict";var n,a,r,s=t(30),o=t(29);a=function(){var t,e,i=0;a.prototype.init.call(this),this.push=function(n){var a;for(e?(a=new Uint8Array(e.byteLength+n.data.byteLength),a.set(e),a.set(n.data,e.byteLength),e=a):e=n.data;i<e.byteLength-3;i++)if(1===e[i+2]){t=i+5;break}for(;t<e.byteLength;)switch(e[t]){case 0:if(0!==e[t-1]){t+=2;break}if(0!==e[t-2]){t++;break}i+3!==t-2&&this.trigger("data",e.subarray(i+3,t-2));do{t++}while(1!==e[t]&&t<e.length);i=t-2,t+=3;break;case 1:if(0!==e[t-1]||0!==e[t-2]){t+=3;break}this.trigger("data",e.subarray(i+3,t-2)),i=t-2,t+=3;break;default:t+=3}e=e.subarray(i),t-=i,i=0},this.flush=function(){e&&e.byteLength>3&&this.trigger("data",e.subarray(i+3)),e=null,i=0,this.trigger("done")}},a.prototype=new s,r={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},n=function(){var t,e,i,s,h,d,p,u=new a;n.prototype.init.call(this),t=this,this.push=function(t){"video"===t.type&&(e=t.trackId,i=t.pts,s=t.dts,u.push(t))},u.on("data",function(n){var a={trackId:e,pts:i,dts:s,data:n};switch(31&n[0]){case 5:a.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:a.nalUnitType="sei_rbsp",a.escapedRBSP=h(n.subarray(1));break;case 7:a.nalUnitType="seq_parameter_set_rbsp",a.escapedRBSP=h(n.subarray(1)),a.config=d(a.escapedRBSP);break;case 8:a.nalUnitType="pic_parameter_set_rbsp";break;case 9:a.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",a)}),u.on("done",function(){t.trigger("done")}),this.flush=function(){u.flush()},p=function(t,e){var i,n,a=8,r=8;for(i=0;i<t;i++)0!==r&&(n=e.readExpGolomb(),r=(a+n+256)%256),a=0===r?a:r},h=function(t){for(var e,i,n=t.byteLength,a=[],r=1;r<n-2;)0===t[r]&&0===t[r+1]&&3===t[r+2]?(a.push(r+2),r+=2):r++;if(0===a.length)return t;e=n-a.length,i=new Uint8Array(e);var s=0;for(r=0;r<e;s++,r++)s===a[0]&&(s++,a.shift()),i[r]=t[s];return i},d=function(t){var e,i,n,a,s,h,d,u,c,l,f,m,g,y=0,b=0,v=0,T=0,S=1;if(e=new o(t),i=e.readUnsignedByte(),a=e.readUnsignedByte(),n=e.readUnsignedByte(),e.skipUnsignedExpGolomb(),r[i]&&(s=e.readUnsignedExpGolomb(),3===s&&e.skipBits(1),e.skipUnsignedExpGolomb(),e.skipUnsignedExpGolomb(),e.skipBits(1),e.readBoolean()))for(f=3!==s?8:12,g=0;g<f;g++)e.readBoolean()&&(g<6?p(16,e):p(64,e));if(e.skipUnsignedExpGolomb(),0===(h=e.readUnsignedExpGolomb()))e.readUnsignedExpGolomb();else if(1===h)for(e.skipBits(1),e.skipExpGolomb(),e.skipExpGolomb(),d=e.readUnsignedExpGolomb(),g=0;g<d;g++)e.skipExpGolomb();if(e.skipUnsignedExpGolomb(),e.skipBits(1),u=e.readUnsignedExpGolomb(),c=e.readUnsignedExpGolomb(),l=e.readBits(1),0===l&&e.skipBits(1),e.skipBits(1),e.readBoolean()&&(y=e.readUnsignedExpGolomb(),b=e.readUnsignedExpGolomb(),v=e.readUnsignedExpGolomb(),T=e.readUnsignedExpGolomb()),e.readBoolean()&&e.readBoolean()){switch(e.readUnsignedByte()){case 1:m=[1,1];break;case 2:m=[12,11];break;case 3:m=[10,11];break;case 4:m=[16,11];break;case 5:m=[40,33];break;case 6:m=[24,11];break;case 7:m=[20,11];break;case 8:m=[32,11];break;case 9:m=[80,33];break;case 10:m=[18,11];break;case 11:m=[15,11];break;case 12:m=[64,33];break;case 13:m=[160,99];break;case 14:m=[4,3];break;case 15:m=[3,2];break;case 16:m=[2,1];break;case 255:m=[e.readUnsignedByte()<<8|e.readUnsignedByte(),e.readUnsignedByte()<<8|e.readUnsignedByte()]}m&&(S=m[0]/m[1])}return{profileIdc:i,levelIdc:n,profileCompatibility:a,width:Math.ceil((16*(u+1)-2*y-2*b)*S),height:(2-l)*(c+1)*16-2*v-2*T}}},n.prototype=new s,e.exports={H264Stream:n,NalByteStream:a}},{}],5:[function(t,e,i){e.exports={adts:t(3),h264:t(4)}},{}],6:[function(t,e,i){var n=[33,16,5,32,164,27],a=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],r=function(t){for(var e=[];t--;)e.push(0);return e},s={96e3:[n,[227,64],r(154),[56]],88200:[n,[231],r(170),[56]],64e3:[n,[248,192],r(240),[56]],48e3:[n,[255,192],r(268),[55,148,128],r(54),[112]],44100:[n,[255,192],r(268),[55,163,128],r(84),[112]],32e3:[n,[255,192],r(268),[55,234],r(226),[112]],24e3:[n,[255,192],r(268),[55,255,128],r(268),[111,112],r(126),[224]],16e3:[n,[255,192],r(268),[55,255,128],r(268),[111,255],r(269),[223,108],r(195),[1,192]],12e3:[a,r(268),[3,127,248],r(268),[6,255,240],r(268),[13,255,224],r(268),[27,253,128],r(259),[56]],11025:[a,r(268),[3,127,248],r(268),[6,255,240],r(268),[13,255,224],r(268),[27,255,192],r(268),[55,175,128],r(108),[112]],8e3:[a,r(268),[3,121,16],r(47),[7]]};e.exports=function(t){return Object.keys(t).reduce(function(e,i){return e[i]=new Uint8Array(t[i].reduce(function(t,e){return t.concat(e)},[])),e},{})}(s)},{}],7:[function(t,e,i){"use strict";var n=t(30),a=function(t){this.numberOfTracks=0,this.metadataStream=t.metadataStream,this.videoTags=[],this.audioTags=[],this.videoTrack=null,this.audioTrack=null,this.pendingCaptions=[],this.pendingMetadata=[],this.pendingTracks=0,this.processedTracks=0,a.prototype.init.call(this),this.push=function(t){return t.text?this.pendingCaptions.push(t):t.frames?this.pendingMetadata.push(t):("video"===t.track.type&&(this.videoTrack=t.track,this.videoTags=t.tags,this.pendingTracks++),void("audio"===t.track.type&&(this.audioTrack=t.track,this.audioTags=t.tags,this.pendingTracks++)))}};a.prototype=new n,a.prototype.flush=function(t){var e,i,n,a,r={tags:{},captions:[],captionStreams:{},metadata:[]};if(this.pendingTracks<this.numberOfTracks){if("VideoSegmentStream"!==t&&"AudioSegmentStream"!==t)return;if(0===this.pendingTracks&&++this.processedTracks<this.numberOfTracks)return}if(this.processedTracks+=this.pendingTracks,this.pendingTracks=0,!(this.processedTracks<this.numberOfTracks)){for(this.videoTrack?a=this.videoTrack.timelineStartInfo.pts:this.audioTrack&&(a=this.audioTrack.timelineStartInfo.pts),r.tags.videoTags=this.videoTags,r.tags.audioTags=this.audioTags,n=0;n<this.pendingCaptions.length;n++)i=this.pendingCaptions[n],i.startTime=i.startPts-a,i.startTime/=9e4,i.endTime=i.endPts-a,i.endTime/=9e4,r.captionStreams[i.stream]=!0,r.captions.push(i);for(n=0;n<this.pendingMetadata.length;n++)e=this.pendingMetadata[n],e.cueTime=e.pts-a,e.cueTime/=9e4,r.metadata.push(e);r.metadata.dispatchType=this.metadataStream.dispatchType,this.videoTrack=null,this.audioTrack=null,this.videoTags=[],this.audioTags=[],this.pendingCaptions.length=0,this.pendingMetadata.length=0,this.pendingTracks=0,this.processedTracks=0,this.trigger("data",r),this.trigger("done")}},e.exports=a},{}],8:[function(t,e,i){"use strict";var n=t(9),a=function(t,e,i){var a,r,s,o=new Uint8Array(9),h=new DataView(o.buffer);return t=t||0,e=void 0===e||e,i=void 0===i||i,h.setUint8(0,70),h.setUint8(1,76),h.setUint8(2,86),h.setUint8(3,1),h.setUint8(4,(e?4:0)|(i?1:0)),h.setUint32(5,o.byteLength),t<=0?(r=new Uint8Array(o.byteLength+4),r.set(o),r.set([0,0,0,0],o.byteLength),r):(a=new n(n.METADATA_TAG),a.pts=a.dts=0,a.writeMetaDataDouble("duration",t),s=a.finalize().length,r=new Uint8Array(o.byteLength+s),r.set(o),r.set(h.byteLength,s),r)};e.exports=a},{}],9:[function(t,e,i){"use strict";var n;n=function(t,e){var i,a=0,r=16384,s=function(t,e){var i,n=t.position+e;n<t.bytes.byteLength||(i=new Uint8Array(2*n),i.set(t.bytes.subarray(0,t.position),0),t.bytes=i,t.view=new DataView(t.bytes.buffer))},o=n.widthBytes||new Uint8Array("width".length),h=n.heightBytes||new Uint8Array("height".length),d=n.videocodecidBytes||new Uint8Array("videocodecid".length);if(!n.widthBytes){for(i=0;i<"width".length;i++)o[i]="width".charCodeAt(i);for(i=0;i<"height".length;i++)h[i]="height".charCodeAt(i);for(i=0;i<"videocodecid".length;i++)d[i]="videocodecid".charCodeAt(i);n.widthBytes=o,n.heightBytes=h,n.videocodecidBytes=d}switch(this.keyFrame=!1,t){case n.VIDEO_TAG:this.length=16,r*=6;break;case n.AUDIO_TAG:this.length=13,this.keyFrame=!0;break;case n.METADATA_TAG:this.length=29,this.keyFrame=!0;break;default:throw new Error("Unknown FLV tag type")}this.bytes=new Uint8Array(r),this.view=new DataView(this.bytes.buffer),this.bytes[0]=t,this.position=this.length,this.keyFrame=e,this.pts=0,this.dts=0,this.writeBytes=function(t,e,i){var n,a=e||0;i=i||t.byteLength,n=a+i,s(this,i),this.bytes.set(t.subarray(a,n),this.position),this.position+=i,this.length=Math.max(this.length,this.position)},this.writeByte=function(t){s(this,1),this.bytes[this.position]=t,this.position++,this.length=Math.max(this.length,this.position)},this.writeShort=function(t){s(this,2),this.view.setUint16(this.position,t),this.position+=2,this.length=Math.max(this.length,this.position)},this.negIndex=function(t){return this.bytes[this.length-t]},this.nalUnitSize=function(){return 0===a?0:this.length-(a+4)},this.startNalUnit=function(){if(a>0)throw new Error("Attempted to create new NAL wihout closing the old one");a=this.length,this.length+=4,this.position=this.length},this.endNalUnit=function(t){var e,i;this.length===a+4?this.length-=4:a>0&&(e=a+4,i=this.length-e,this.position=a,this.view.setUint32(this.position,i),this.position=this.length,t&&t.push(this.bytes.subarray(e,e+i))),a=0},this.writeMetaDataDouble=function(t,e){var i;if(s(this,2+t.length+9),this.view.setUint16(this.position,t.length),this.position+=2,"width"===t)this.bytes.set(o,this.position),this.position+=5;else if("height"===t)this.bytes.set(h,this.position),this.position+=6;else if("videocodecid"===t)this.bytes.set(d,this.position),this.position+=12;else for(i=0;i<t.length;i++)this.bytes[this.position]=t.charCodeAt(i),this.position++;this.position++,this.view.setFloat64(this.position,e),this.position+=8,this.length=Math.max(this.length,this.position),++a},this.writeMetaDataBoolean=function(t,e){var i;for(s(this,2),this.view.setUint16(this.position,t.length),this.position+=2,i=0;i<t.length;i++)s(this,1),this.bytes[this.position]=t.charCodeAt(i),this.position++;s(this,2),this.view.setUint8(this.position,1),this.position++,this.view.setUint8(this.position,e?1:0),this.position++,this.length=Math.max(this.length,this.position),++a},this.finalize=function(){var t,i;switch(this.bytes[0]){case n.VIDEO_TAG:this.bytes[11]=7|(this.keyFrame||e?16:32),this.bytes[12]=e?0:1,t=this.pts-this.dts,this.bytes[13]=(16711680&t)>>>16,this.bytes[14]=(65280&t)>>>8,this.bytes[15]=(255&t)>>>0;break;case n.AUDIO_TAG:this.bytes[11]=175,this.bytes[12]=e?0:1;break;case n.METADATA_TAG:this.position=11,this.view.setUint8(this.position,2),this.position++,this.view.setUint16(this.position,10),this.position+=2,this.bytes.set([111,110,77,101,116,97,68,97,116,97],this.position),this.position+=10,this.bytes[this.position]=8,this.position++,this.view.setUint32(this.position,a),this.position=this.length,this.bytes.set([0,0,9],this.position),this.position+=3,this.length=this.position}return i=this.length-11,this.bytes[1]=(16711680&i)>>>16,this.bytes[2]=(65280&i)>>>8,this.bytes[3]=(255&i)>>>0,this.bytes[4]=(16711680&this.dts)>>>16,this.bytes[5]=(65280&this.dts)>>>8,this.bytes[6]=(255&this.dts)>>>0,this.bytes[7]=(4278190080&this.dts)>>>24,this.bytes[8]=0,this.bytes[9]=0,this.bytes[10]=0,s(this,4),this.view.setUint32(this.length,this.length),this.length+=4,this.position+=4,this.bytes=this.bytes.subarray(0,this.length),this.frameTime=n.frameTime(this.bytes),this}},n.AUDIO_TAG=8,n.VIDEO_TAG=9,n.METADATA_TAG=18,n.isAudioFrame=function(t){return n.AUDIO_TAG===t[0]},n.isVideoFrame=function(t){return n.VIDEO_TAG===t[0]},n.isMetaData=function(t){return n.METADATA_TAG===t[0]},n.isKeyFrame=function(t){return n.isVideoFrame(t)?23===t[11]:!!n.isAudioFrame(t)||!!n.isMetaData(t)},n.frameTime=function(t){var e=t[4]<<16;return e|=t[5]<<8,e|=t[6]<<0,e|=t[7]<<24},e.exports=n},{}],10:[function(t,e,i){e.exports={tag:t(9),Transmuxer:t(12),getFlvHeader:t(8)}},{}],11:[function(t,e,i){"use strict";var n=function(){var t=this;this.list=[],this.push=function(t){this.list.push({bytes:t.bytes,dts:t.dts,pts:t.pts,keyFrame:t.keyFrame,metaDataTag:t.metaDataTag})},Object.defineProperty(this,"length",{get:function(){return t.list.length}})};e.exports=n},{}],12:[function(t,e,i){"use strict";var n,a,r,s,o,h,d=t(30),p=t(9),u=t(16),c=t(3),l=t(4).H264Stream,f=t(7),m=t(11);s=function(t,e){"number"==typeof e.pts&&(void 0===t.timelineStartInfo.pts?t.timelineStartInfo.pts=e.pts:t.timelineStartInfo.pts=Math.min(t.timelineStartInfo.pts,e.pts)),"number"==typeof e.dts&&(void 0===t.timelineStartInfo.dts?t.timelineStartInfo.dts=e.dts:t.timelineStartInfo.dts=Math.min(t.timelineStartInfo.dts,e.dts))},o=function(t,e){var i=new p(p.METADATA_TAG);return i.dts=e,i.pts=e,i.writeMetaDataDouble("videocodecid",7),i.writeMetaDataDouble("width",t.width),i.writeMetaDataDouble("height",t.height),i},h=function(t,e){var i,n=new p(p.VIDEO_TAG,!0);for(n.dts=e,n.pts=e,n.writeByte(1),n.writeByte(t.profileIdc),n.writeByte(t.profileCompatibility),n.writeByte(t.levelIdc),n.writeByte(255),n.writeByte(225),n.writeShort(t.sps[0].length),n.writeBytes(t.sps[0]),n.writeByte(t.pps.length),i=0;i<t.pps.length;++i)n.writeShort(t.pps[i].length),n.writeBytes(t.pps[i]);return n},r=function(t){var e,i=[],n=[];r.prototype.init.call(this),this.push=function(e){s(t,e),t&&(t.audioobjecttype=e.audioobjecttype,t.channelcount=e.channelcount,t.samplerate=e.samplerate,t.samplingfrequencyindex=e.samplingfrequencyindex,t.samplesize=e.samplesize,t.extraData=t.audioobjecttype<<11|t.samplingfrequencyindex<<7|t.channelcount<<3),e.pts=Math.round(e.pts/90),e.dts=Math.round(e.dts/90),i.push(e)},this.flush=function(){var a,r,s,o=new m;if(0===i.length)return void this.trigger("done","AudioSegmentStream");for(s=-1/0;i.length;)a=i.shift(),n.length&&a.pts>=n[0]&&(s=n.shift(),this.writeMetaDataTags(o,s)),(t.extraData!==e||a.pts-s>=1e3)&&(this.writeMetaDataTags(o,a.pts),e=t.extraData,s=a.pts),r=new p(p.AUDIO_TAG),r.pts=a.pts,r.dts=a.dts,r.writeBytes(a.data),o.push(r.finalize());n.length=0,e=null,this.trigger("data",{track:t,tags:o.list}),this.trigger("done","AudioSegmentStream")},this.writeMetaDataTags=function(e,i){var n;n=new p(p.METADATA_TAG),n.pts=i,n.dts=i,n.writeMetaDataDouble("audiocodecid",10),n.writeMetaDataBoolean("stereo",2===t.channelcount),n.writeMetaDataDouble("audiosamplerate",t.samplerate),n.writeMetaDataDouble("audiosamplesize",16),e.push(n.finalize()),n=new p(p.AUDIO_TAG,!0),n.pts=i,n.dts=i,n.view.setUint16(n.position,t.extraData),n.position+=2,n.length=Math.max(n.length,n.position),e.push(n.finalize())},this.onVideoKeyFrame=function(t){n.push(t)}},r.prototype=new d,a=function(t){var e,i,n=[];a.prototype.init.call(this),this.finishFrame=function(n,a){if(a){if(e&&t&&t.newMetadata&&(a.keyFrame||0===n.length)){var r=o(e,a.dts).finalize(),s=h(t,a.dts).finalize();r.metaDataTag=s.metaDataTag=!0,n.push(r),n.push(s),t.newMetadata=!1,this.trigger("keyframe",a.dts)}a.endNalUnit(),n.push(a.finalize()),i=null}},this.push=function(e){s(t,e),e.pts=Math.round(e.pts/90),e.dts=Math.round(e.dts/90),n.push(e)},this.flush=function(){for(var a,r=new m;n.length&&"access_unit_delimiter_rbsp"!==n[0].nalUnitType;)n.shift();if(0===n.length)return void this.trigger("done","VideoSegmentStream");for(;n.length;)a=n.shift(),"seq_parameter_set_rbsp"===a.nalUnitType?(t.newMetadata=!0,e=a.config,t.width=e.width,t.height=e.height,t.sps=[a.data],t.profileIdc=e.profileIdc,t.levelIdc=e.levelIdc,t.profileCompatibility=e.profileCompatibility,i.endNalUnit()):"pic_parameter_set_rbsp"===a.nalUnitType?(t.newMetadata=!0,t.pps=[a.data],i.endNalUnit()):"access_unit_delimiter_rbsp"===a.nalUnitType?(i&&this.finishFrame(r,i),i=new p(p.VIDEO_TAG),i.pts=a.pts,i.dts=a.dts):("slice_layer_without_partitioning_rbsp_idr"===a.nalUnitType&&(i.keyFrame=!0),i.endNalUnit()),i.startNalUnit(),i.writeBytes(a.data);i&&this.finishFrame(r,i),this.trigger("data",{track:t,tags:r.list}),this.trigger("done","VideoSegmentStream")}},a.prototype=new d,n=function(t){var e,i,s,o,h,d,p,m,g,y,b,v,T=this;n.prototype.init.call(this),t=t||{},this.metadataStream=new u.MetadataStream,t.metadataStream=this.metadataStream,e=new u.TransportPacketStream,i=new u.TransportParseStream,s=new u.ElementaryStream,o=new u.TimestampRolloverStream("video"),h=new u.TimestampRolloverStream("audio"),d=new u.TimestampRolloverStream("timed-metadata"),p=new c,m=new l,v=new f(t),e.pipe(i).pipe(s),s.pipe(o).pipe(m),s.pipe(h).pipe(p),s.pipe(d).pipe(this.metadataStream).pipe(v),b=new u.CaptionStream,m.pipe(b).pipe(v),s.on("data",function(t){var e,i,n;if("metadata"===t.type){for(e=t.tracks.length;e--;)"video"===t.tracks[e].type?i=t.tracks[e]:"audio"===t.tracks[e].type&&(n=t.tracks[e]);i&&!g&&(v.numberOfTracks++,g=new a(i),m.pipe(g).pipe(v)),n&&!y&&(v.numberOfTracks++,y=new r(n),p.pipe(y).pipe(v),g&&g.on("keyframe",y.onVideoKeyFrame))}}),this.push=function(t){e.push(t)},this.flush=function(){e.flush()},this.resetCaptions=function(){b.reset()},v.on("data",function(t){T.trigger("data",t)}),v.on("done",function(){T.trigger("done")})},n.prototype=new d,e.exports=n},{}],13:[function(t,e,i){"use strict";var n={codecs:t(5),mp4:t(21),flv:t(10),mp2t:t(15)};n.mp4.tools=t(26),n.flv.tools=t(25),n.mp2t.tools=t(27),e.exports=n},{}],14:[function(t,e,i){"use strict";var n=t(30),a=function(t){for(var e=0,i={payloadType:-1,payloadSize:0},n=0,a=0;e<t.byteLength&&128!==t[e];){for(;255===t[e];)n+=255,e++;for(n+=t[e++];255===t[e];)a+=255,e++;if(a+=t[e++],!i.payload&&4===n){i.payloadType=n,i.payloadSize=a,i.payload=t.subarray(e,e+a);break}e+=a,n=0,a=0}return i},r=function(t){return 181!==t.payload[0]?null:49!=(t.payload[1]<<8|t.payload[2])?null:"GA94"!==String.fromCharCode(t.payload[3],t.payload[4],t.payload[5],t.payload[6])?null:3!==t.payload[7]?null:t.payload.subarray(8,t.payload.length-1)},s=function(t,e){var i,n,a,r,s=[];if(!(64&e[0]))return s;for(n=31&e[0],i=0;i<n;i++)a=3*i,r={type:3&e[a+2],pts:t},4&e[a+2]&&(r.ccData=e[a+3]<<8|e[a+4],s.push(r));return s},o=function(){o.prototype.init.call(this),this.captionPackets_=[],this.ccStreams_=[new c(0,0),new c(0,1),new c(1,0),new c(1,1)],this.reset(),this.ccStreams_.forEach(function(t){t.on("data",this.trigger.bind(this,"data")),t.on("done",this.trigger.bind(this,"done"))},this)};o.prototype=new n,o.prototype.push=function(t){var e,i;if("sei_rbsp"===t.nalUnitType&&(e=a(t.escapedRBSP),4===e.payloadType&&(i=r(e)))){if(t.dts<this.latestDts_)return void(this.ignoreNextEqualDts_=!0);if(t.dts===this.latestDts_&&this.ignoreNextEqualDts_)return void(this.ignoreNextEqualDts_=!1);this.captionPackets_=this.captionPackets_.concat(s(t.pts,i)),this.latestDts_=t.dts}},o.prototype.flush=function(){if(!this.captionPackets_.length)return void this.ccStreams_.forEach(function(t){t.flush()},this);this.captionPackets_.forEach(function(t,e){t.presortIndex=e}),this.captionPackets_.sort(function(t,e){return t.pts===e.pts?t.presortIndex-e.presortIndex:t.pts-e.pts}),this.captionPackets_.forEach(function(t){t.type<2&&this.dispatchCea608Packet(t)},this),this.captionPackets_.length=0,this.ccStreams_.forEach(function(t){t.flush()},this)},o.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(t){t.reset()})},o.prototype.dispatchCea608Packet=function(t){this.setsChannel1Active(t)?this.activeCea608Channel_[t.type]=0:this.setsChannel2Active(t)&&(this.activeCea608Channel_[t.type]=1),null!==this.activeCea608Channel_[t.type]&&this.ccStreams_[(t.type<<1)+this.activeCea608Channel_[t.type]].push(t)},o.prototype.setsChannel1Active=function(t){return 4096==(30720&t.ccData)},o.prototype.setsChannel2Active=function(t){return 6144==(30720&t.ccData)};var h={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},d=function(t){return null===t?"":(t=h[t]||t,String.fromCharCode(t))},p=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],u=function(){for(var t=[],e=15;e--;)t.push("");return t},c=function(t,e){c.prototype.init.call(this),this.field_=t||0,this.dataChannel_=e||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(t){var e,i,n,a,r;if((e=32639&t.ccData)===this.lastControlCode_)return void(this.lastControlCode_=null);if(4096==(61440&e)?this.lastControlCode_=e:e!==this.PADDING_&&(this.lastControlCode_=null),n=e>>>8,a=255&e,e!==this.PADDING_)if(e===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(e===this.END_OF_CAPTION_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=t.pts;else if(e===this.ROLL_UP_2_ROWS_)this.topRow_=13,this.mode_="rollUp";else if(e===this.ROLL_UP_3_ROWS_)this.topRow_=12,this.mode_="rollUp";else if(e===this.ROLL_UP_4_ROWS_)this.topRow_=11,this.mode_="rollUp";else if(e===this.CARRIAGE_RETURN_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),this.shiftRowsUp_(),this.startPts_=t.pts;else if(e===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[14]=this.nonDisplayed_[14].slice(0,-1):this.displayed_[14]=this.displayed_[14].slice(0,-1);else if(e===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(t.pts),this.displayed_=u();else if(e===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=u();else if(e===this.RESUME_DIRECT_CAPTIONING_)this.mode_="paintOn";else if(this.isSpecialCharacter(n,a))n=(3&n)<<8,r=d(n|a),this[this.mode_](t.pts,r),this.column_++;else if(this.isExtCharacter(n,a))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[14]=this.displayed_[14].slice(0,-1),n=(3&n)<<8,r=d(n|a),this[this.mode_](t.pts,r),this.column_++;else if(this.isMidRowCode(n,a))this.clearFormatting(t.pts),this[this.mode_](t.pts," "),this.column_++,14==(14&a)&&this.addFormatting(t.pts,["i"]),1==(1&a)&&this.addFormatting(t.pts,["u"]);else if(this.isOffsetControlCode(n,a))this.column_+=3&a;else if(this.isPAC(n,a)){var s=p.indexOf(7968&e);s!==this.row_&&(this.clearFormatting(t.pts),this.row_=s),1&a&&-1===this.formatting_.indexOf("u")&&this.addFormatting(t.pts,["u"]),16==(16&e)&&(this.column_=4*((14&e)>>1)),this.isColorPAC(a)&&14==(14&a)&&this.addFormatting(t.pts,["i"])}else this.isNormalChar(n)&&(0===a&&(a=null),r=d(n),r+=d(a),this[this.mode_](t.pts,r),this.column_+=r.length)}};c.prototype=new n,c.prototype.flushDisplayed=function(t){var e=this.displayed_.map(function(t){return t.trim()}).join("\n").replace(/^\n+|\n+$/g,"");e.length&&this.trigger("data",{startPts:this.startPts_,endPts:t,text:e,stream:this.name_})},c.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=u(),this.nonDisplayed_=u(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.formatting_=[]},c.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},c.prototype.isSpecialCharacter=function(t,e){return t===this.EXT_&&e>=48&&e<=63},c.prototype.isExtCharacter=function(t,e){return(t===this.EXT_+1||t===this.EXT_+2)&&e>=32&&e<=63},c.prototype.isMidRowCode=function(t,e){return t===this.EXT_&&e>=32&&e<=47},c.prototype.isOffsetControlCode=function(t,e){return t===this.OFFSET_&&e>=33&&e<=35},c.prototype.isPAC=function(t,e){return t>=this.BASE_&&t<this.BASE_+8&&e>=64&&e<=127},c.prototype.isColorPAC=function(t){return t>=64&&t<=79||t>=96&&t<=127},c.prototype.isNormalChar=function(t){return t>=32&&t<=127},c.prototype.addFormatting=function(t,e){this.formatting_=this.formatting_.concat(e);var i=e.reduce(function(t,e){return t+"<"+e+">"},"");this[this.mode_](t,i)},c.prototype.clearFormatting=function(t){if(this.formatting_.length){var e=this.formatting_.reverse().reduce(function(t,e){return t+"</"+e+">"},"");this.formatting_=[],this[this.mode_](t,e)}},c.prototype.popOn=function(t,e){var i=this.nonDisplayed_[this.row_];i+=e,this.nonDisplayed_[this.row_]=i},c.prototype.rollUp=function(t,e){var i=this.displayed_[14];i+=e,this.displayed_[14]=i},c.prototype.shiftRowsUp_=function(){var t;for(t=0;t<this.topRow_;t++)this.displayed_[t]="";for(t=this.topRow_;t<14;t++)this.displayed_[t]=this.displayed_[t+1];this.displayed_[14]=""},c.prototype.paintOn=function(){},e.exports={CaptionStream:o,Cea608Stream:c}},{}],15:[function(t,e,i){e.exports=t(16)},{}],16:[function(t,e,i){"use strict";var n,a,r,s=t(30),o=t(14),h=t(19),d=t(20).TimestampRolloverStream,p=t(19);n=function(){var t=new Uint8Array(188),e=0;n.prototype.init.call(this),this.push=function(i){var n,a=0,r=188;for(e?(n=new Uint8Array(i.byteLength+e),n.set(t.subarray(0,e)),n.set(i,e),e=0):n=i;r<n.byteLength;)71!==n[a]||71!==n[r]?(a++,r++):(this.trigger("data",n.subarray(a,r)),a+=188,r+=188);a<n.byteLength&&(t.set(n.subarray(a),0),e=n.byteLength-a)},this.flush=function(){188===e&&71===t[0]&&(this.trigger("data",t),e=0),this.trigger("done")}},n.prototype=new s,a=function(){var t,e,i,n;a.prototype.init.call(this),n=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,t=function(t,n){var a=0;n.payloadUnitStartIndicator&&(a+=t[a]+1),"pat"===n.type?e(t.subarray(a),n):i(t.subarray(a),n)},e=function(t,e){e.section_number=t[7],e.last_section_number=t[8],n.pmtPid=(31&t[10])<<8|t[11],e.pmtPid=n.pmtPid},i=function(t,e){var i,a,r,s;if(1&t[5]){for(n.programMapTable={video:null,audio:null,"timed-metadata":{}},i=(15&t[1])<<8|t[2],a=3+i-4,r=(15&t[10])<<8|t[11],s=12+r;s<a;){var o=t[s],d=(31&t[s+1])<<8|t[s+2];o===h.H264_STREAM_TYPE&&null===n.programMapTable.video?n.programMapTable.video=d:o===h.ADTS_STREAM_TYPE&&null===n.programMapTable.audio?n.programMapTable.audio=d:o===h.METADATA_STREAM_TYPE&&(n.programMapTable["timed-metadata"][d]=o),s+=5+((15&t[s+3])<<8|t[s+4])}e.programMapTable=n.programMapTable}},this.push=function(e){var i={},n=4;if(i.payloadUnitStartIndicator=!!(64&e[1]),i.pid=31&e[1],i.pid<<=8,i.pid|=e[2],(48&e[3])>>>4>1&&(n+=e[n]+1),0===i.pid)i.type="pat",t(e.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",t(e.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([e,n,i]):this.processPes_(e,n,i)},this.processPes_=function(t,e,i){i.pid===this.programMapTable.video?i.streamType=h.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=h.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=t.subarray(e),this.trigger("data",i)}},a.prototype=new s,a.STREAM_TYPES={h264:27,adts:15},r=function(){var t=this,e={data:[],size:0},i={data:[],size:0},n={data:[],size:0},a=function(t,e){var i;e.packetLength=6+(t[4]<<8|t[5]),e.dataAlignmentIndicator=0!=(4&t[6]),i=t[7],192&i&&(e.pts=(14&t[9])<<27|(255&t[10])<<20|(254&t[11])<<12|(255&t[12])<<5|(254&t[13])>>>3,e.pts*=4,e.pts+=(6&t[13])>>>1,e.dts=e.pts,64&i&&(e.dts=(14&t[14])<<27|(255&t[15])<<20|(254&t[16])<<12|(255&t[17])<<5|(254&t[18])>>>3,e.dts*=4,e.dts+=(6&t[18])>>>1)),e.data=t.subarray(9+t[8])},s=function(e,i,n){var r,s=new Uint8Array(e.size),o={type:i},h=0,d=0,p=!1;if(e.data.length&&!(e.size<9)){for(o.trackId=e.data[0].pid,h=0;h<e.data.length;h++)r=e.data[h],s.set(r.data,d),d+=r.data.byteLength;a(s,o),p="video"===i||o.packetLength<=e.size,(n||p)&&(e.size=0,e.data.length=0),p&&t.trigger("data",o)}};r.prototype.init.call(this),this.push=function(a){({pat:function(){},pes:function(){var t,r;switch(a.streamType){case h.H264_STREAM_TYPE:case p.H264_STREAM_TYPE:t=e,r="video";break;case h.ADTS_STREAM_TYPE:t=i,r="audio";break
;case h.METADATA_STREAM_TYPE:t=n,r="timed-metadata";break;default:return}a.payloadUnitStartIndicator&&s(t,r,!0),t.data.push(a),t.size+=a.data.byteLength},pmt:function(){var e={type:"metadata",tracks:[]},i=a.programMapTable;null!==i.video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+i.video,codec:"avc",type:"video"}),null!==i.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+i.audio,codec:"adts",type:"audio"}),t.trigger("data",e)}})[a.type]()},this.flush=function(){s(e,"video"),s(i,"audio"),s(n,"timed-metadata"),this.trigger("done")}},r.prototype=new s;var u={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:n,TransportParseStream:a,ElementaryStream:r,TimestampRolloverStream:d,CaptionStream:o.CaptionStream,Cea608Stream:o.Cea608Stream,MetadataStream:t(17)};for(var c in h)h.hasOwnProperty(c)&&(u[c]=h[c]);e.exports=u},{}],17:[function(t,e,i){"use strict";var n,a=t(30),r=t(19),s=function(t,e,i){var n,a="";for(n=e;n<i;n++)a+="%"+("00"+t[n].toString(16)).slice(-2);return a},o=function(t,e,i){return decodeURIComponent(s(t,e,i))},h=function(t,e,i){return unescape(s(t,e,i))},d=function(t){return t[0]<<21|t[1]<<14|t[2]<<7|t[3]},p={TXXX:function(t){var e;if(3===t.data[0]){for(e=1;e<t.data.length;e++)if(0===t.data[e]){t.description=o(t.data,1,e),t.value=o(t.data,e+1,t.data.length).replace(/\0*$/,"");break}t.data=t.value}},WXXX:function(t){var e;if(3===t.data[0])for(e=1;e<t.data.length;e++)if(0===t.data[e]){t.description=o(t.data,1,e),t.url=o(t.data,e+1,t.data.length);break}},PRIV:function(t){var e;for(e=0;e<t.data.length;e++)if(0===t.data[e]){t.owner=h(t.data,0,e);break}t.privateData=t.data.subarray(e+1),t.data=t.privateData}};n=function(t){var e,i={debug:!(!t||!t.debug),descriptor:t&&t.descriptor},a=0,s=[],o=0;if(n.prototype.init.call(this),this.dispatchType=r.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(e=0;e<i.descriptor.length;e++)this.dispatchType+=("00"+i.descriptor[e].toString(16)).slice(-2);this.push=function(t){var e,n,r,h,u,c;if("timed-metadata"===t.type){if(t.dataAlignmentIndicator&&(o=0,s.length=0),0===s.length&&(t.data.length<10||t.data[0]!=="I".charCodeAt(0)||t.data[1]!=="D".charCodeAt(0)||t.data[2]!=="3".charCodeAt(0)))return void(i.debug&&console.log("Skipping unrecognized metadata packet"));if(s.push(t),o+=t.data.byteLength,1===s.length&&(a=d(t.data.subarray(6,10)),a+=10),!(o<a)){for(e={data:new Uint8Array(a),frames:[],pts:s[0].pts,dts:s[0].dts},u=0;u<a;)e.data.set(s[0].data.subarray(0,a-u),u),u+=s[0].data.byteLength,o-=s[0].data.byteLength,s.shift();n=10,64&e.data[5]&&(n+=4,n+=d(e.data.subarray(10,14)),a-=d(e.data.subarray(16,20)));do{if((r=d(e.data.subarray(n+4,n+8)))<1)return console.log("Malformed ID3 frame encountered. Skipping metadata parsing.");if(c=String.fromCharCode(e.data[n],e.data[n+1],e.data[n+2],e.data[n+3]),h={id:c,data:e.data.subarray(n+10,n+r+10)},h.key=h.id,p[h.id]&&(p[h.id](h),"com.apple.streaming.transportStreamTimestamp"===h.owner)){var l=h.data,f=(1&l[3])<<30|l[4]<<22|l[5]<<14|l[6]<<6|l[7]>>>2;f*=4,f+=3&l[7],h.timeStamp=f,void 0===e.pts&&void 0===e.dts&&(e.pts=h.timeStamp,e.dts=h.timeStamp),this.trigger("timestamp",h)}e.frames.push(h),n+=10,n+=r}while(n<a);this.trigger("data",e)}}}},n.prototype=new a,e.exports=n},{}],18:[function(t,e,i){"use strict";var n=t(19),a=function(t){var e=31&t[1];return e<<=8,e|=t[2]},r=function(t){return!!(64&t[1])},s=function(t){var e=0;return(48&t[3])>>>4>1&&(e+=t[4]+1),e},o=function(t,e){var i=a(t);return 0===i?"pat":i===e?"pmt":e?"pes":null},h=function(t){var e=r(t),i=4+s(t);return e&&(i+=t[i]+1),(31&t[i+10])<<8|t[i+11]},d=function(t){var e={},i=r(t),n=4+s(t);if(i&&(n+=t[n]+1),1&t[n+5]){var a,o,h;a=(15&t[n+1])<<8|t[n+2],o=3+a-4,h=(15&t[n+10])<<8|t[n+11];for(var d=12+h;d<o;){var p=n+d;e[(31&t[p+1])<<8|t[p+2]]=t[p],d+=5+((15&t[p+3])<<8|t[p+4])}return e}},p=function(t,e){switch(e[a(t)]){case n.H264_STREAM_TYPE:return"video";case n.ADTS_STREAM_TYPE:return"audio";case n.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},u=function(t){if(!r(t))return null;var e=4+s(t);if(e>=t.byteLength)return null;var i,n=null;return i=t[e+7],192&i&&(n={},n.pts=(14&t[e+9])<<27|(255&t[e+10])<<20|(254&t[e+11])<<12|(255&t[e+12])<<5|(254&t[e+13])>>>3,n.pts*=4,n.pts+=(6&t[e+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&t[e+14])<<27|(255&t[e+15])<<20|(254&t[e+16])<<12|(255&t[e+17])<<5|(254&t[e+18])>>>3,n.dts*=4,n.dts+=(6&t[e+18])>>>1)),n},c=function(t){switch(t){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},l=function(t){for(var e,i=4+s(t),n=t.subarray(i),a=0,r=0,o=!1;r<n.byteLength-3;r++)if(1===n[r+2]){a=r+5;break}for(;a<n.byteLength;)switch(n[a]){case 0:if(0!==n[a-1]){a+=2;break}if(0!==n[a-2]){a++;break}r+3!==a-2&&"slice_layer_without_partitioning_rbsp_idr"===(e=c(31&n[r+3]))&&(o=!0);do{a++}while(1!==n[a]&&a<n.length);r=a-2,a+=3;break;case 1:if(0!==n[a-1]||0!==n[a-2]){a+=3;break}e=c(31&n[r+3]),"slice_layer_without_partitioning_rbsp_idr"===e&&(o=!0),r=a-2,a+=3;break;default:a+=3}return n=n.subarray(r),a-=r,r=0,n&&n.byteLength>3&&"slice_layer_without_partitioning_rbsp_idr"===(e=c(31&n[r+3]))&&(o=!0),o};e.exports={parseType:o,parsePat:h,parsePmt:d,parsePayloadUnitStartIndicator:r,parsePesType:p,parsePesTime:u,videoPacketContainsKeyFrame:l}},{}],19:[function(t,e,i){"use strict";e.exports={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21}},{}],20:[function(t,e,i){"use strict";var n=t(30),a=function(t,e){var i=1;for(t>e&&(i=-1);Math.abs(e-t)>4294967296;)t+=8589934592*i;return t},r=function(t){var e,i;r.prototype.init.call(this),this.type_=t,this.push=function(t){t.type===this.type_&&(void 0===i&&(i=t.dts),t.dts=a(t.dts,i),t.pts=a(t.pts,i),e=t.dts,this.trigger("data",t))},this.flush=function(){i=e,this.trigger("done")},this.discontinuity=function(){i=void 0,e=void 0}};r.prototype=new n,e.exports={TimestampRolloverStream:r,handleRollover:a}},{}],21:[function(t,e,i){e.exports={generator:t(22),Transmuxer:t(24).Transmuxer,AudioSegmentStream:t(24).AudioSegmentStream,VideoSegmentStream:t(24).VideoSegmentStream}},{}],22:[function(t,e,i){"use strict";var n,a,r,s,o,h,d,p,u,c,l,f,m,g,y,b,v,T,S,_,w,A,U,k,D,C,L,M,x,P,E,O,I,R,B,F,z=Math.pow(2,32)-1;!function(){var t;if(U={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(t in U)U.hasOwnProperty(t)&&(U[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);k=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),C=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),D=new Uint8Array([0,0,0,1]),L=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]),M=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]),x={video:L,audio:M},O=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),E=new Uint8Array([0,0,0,0,0,0,0,0]),I=new Uint8Array([0,0,0,0,0,0,0,0]),R=I,B=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),F=I,P=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),n=function(t){var e,i,n,a=[],r=0;for(e=1;e<arguments.length;e++)a.push(arguments[e]);for(e=a.length;e--;)r+=a[e].byteLength;for(i=new Uint8Array(r+8),n=new DataView(i.buffer,i.byteOffset,i.byteLength),n.setUint32(0,i.byteLength),i.set(t,4),e=0,r=8;e<a.length;e++)i.set(a[e],r),r+=a[e].byteLength;return i},a=function(){return n(U.dinf,n(U.dref,O))},r=function(t){return n(U.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,t.audioobjecttype<<3|t.samplingfrequencyindex>>>1,t.samplingfrequencyindex<<7|t.channelcount<<3,6,1,2]))},s=function(){return n(U.ftyp,k,D,k,C)},b=function(t){return n(U.hdlr,x[t])},o=function(t){return n(U.mdat,t)},y=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,t.duration>>>24&255,t.duration>>>16&255,t.duration>>>8&255,255&t.duration,85,196,0,0]);return t.samplerate&&(e[12]=t.samplerate>>>24&255,e[13]=t.samplerate>>>16&255,e[14]=t.samplerate>>>8&255,e[15]=255&t.samplerate),n(U.mdhd,e)},g=function(t){return n(U.mdia,y(t),b(t.type),d(t))},h=function(t){return n(U.mfhd,new Uint8Array([0,0,0,0,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t]))},d=function(t){return n(U.minf,"video"===t.type?n(U.vmhd,P):n(U.smhd,E),a(),T(t))},p=function(t,e){for(var i=[],a=e.length;a--;)i[a]=_(e[a]);return n.apply(null,[U.moof,h(t)].concat(i))},u=function(t){for(var e=t.length,i=[];e--;)i[e]=f(t[e]);return n.apply(null,[U.moov,l(4294967295)].concat(i).concat(c(t)))},c=function(t){for(var e=t.length,i=[];e--;)i[e]=w(t[e]);return n.apply(null,[U.mvex].concat(i))},l=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t,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(U.mvhd,e)},v=function(t){var e,i,a=t.samples||[],r=new Uint8Array(4+a.length);for(i=0;i<a.length;i++)e=a[i].flags,r[i+4]=e.dependsOn<<4|e.isDependedOn<<2|e.hasRedundancy;return n(U.sdtp,r)},T=function(t){return n(U.stbl,S(t),n(U.stts,F),n(U.stsc,R),n(U.stsz,B),n(U.stco,I))},function(){var t,e;S=function(i){return n(U.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===i.type?t(i):e(i))},t=function(t){var e,i=t.sps||[],a=t.pps||[],r=[],s=[];for(e=0;e<i.length;e++)r.push((65280&i[e].byteLength)>>>8),r.push(255&i[e].byteLength),r=r.concat(Array.prototype.slice.call(i[e]));for(e=0;e<a.length;e++)s.push((65280&a[e].byteLength)>>>8),s.push(255&a[e].byteLength),s=s.concat(Array.prototype.slice.call(a[e]));return n(U.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,(65280&t.width)>>8,255&t.width,(65280&t.height)>>8,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),n(U.avcC,new Uint8Array([1,t.profileIdc,t.profileCompatibility,t.levelIdc,255].concat([i.length]).concat(r).concat([a.length]).concat(s))),n(U.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))},e=function(t){return n(U.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&t.channelcount)>>8,255&t.channelcount,(65280&t.samplesize)>>8,255&t.samplesize,0,0,0,0,(65280&t.samplerate)>>8,255&t.samplerate,0,0]),r(t))}}(),m=function(t){var e=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,0,(4278190080&t.duration)>>24,(16711680&t.duration)>>16,(65280&t.duration)>>8,255&t.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,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,(65280&t.width)>>8,255&t.width,0,0,(65280&t.height)>>8,255&t.height,0,0]);return n(U.tkhd,e)},_=function(t){var e,i,a,r,s,o,h;return e=n(U.tfhd,new Uint8Array([0,0,0,58,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),o=Math.floor(t.baseMediaDecodeTime/(z+1)),h=Math.floor(t.baseMediaDecodeTime%(z+1)),i=n(U.tfdt,new Uint8Array([1,0,0,0,o>>>24&255,o>>>16&255,o>>>8&255,255&o,h>>>24&255,h>>>16&255,h>>>8&255,255&h])),s=92,"audio"===t.type?(a=A(t,s),n(U.traf,e,i,a)):(r=v(t),a=A(t,r.length+s),n(U.traf,e,i,a,r))},f=function(t){return t.duration=t.duration||4294967295,n(U.trak,m(t),g(t))},w=function(t){var e=new Uint8Array([0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==t.type&&(e[e.length-1]=0),n(U.trex,e)},function(){var t,e,i;i=function(t,e){var i=0,n=0,a=0,r=0;return t.length&&(void 0!==t[0].duration&&(i=1),void 0!==t[0].size&&(n=2),void 0!==t[0].flags&&(a=4),void 0!==t[0].compositionTimeOffset&&(r=8)),[0,0,i|n|a|r,1,(4278190080&t.length)>>>24,(16711680&t.length)>>>16,(65280&t.length)>>>8,255&t.length,(4278190080&e)>>>24,(16711680&e)>>>16,(65280&e)>>>8,255&e]},e=function(t,e){var a,r,s,o;for(r=t.samples||[],e+=20+16*r.length,a=i(r,e),o=0;o<r.length;o++)s=r[o],a=a.concat([(4278190080&s.duration)>>>24,(16711680&s.duration)>>>16,(65280&s.duration)>>>8,255&s.duration,(4278190080&s.size)>>>24,(16711680&s.size)>>>16,(65280&s.size)>>>8,255&s.size,s.flags.isLeading<<2|s.flags.dependsOn,s.flags.isDependedOn<<6|s.flags.hasRedundancy<<4|s.flags.paddingValue<<1|s.flags.isNonSyncSample,61440&s.flags.degradationPriority,15&s.flags.degradationPriority,(4278190080&s.compositionTimeOffset)>>>24,(16711680&s.compositionTimeOffset)>>>16,(65280&s.compositionTimeOffset)>>>8,255&s.compositionTimeOffset]);return n(U.trun,new Uint8Array(a))},t=function(t,e){var a,r,s,o;for(r=t.samples||[],e+=20+8*r.length,a=i(r,e),o=0;o<r.length;o++)s=r[o],a=a.concat([(4278190080&s.duration)>>>24,(16711680&s.duration)>>>16,(65280&s.duration)>>>8,255&s.duration,(4278190080&s.size)>>>24,(16711680&s.size)>>>16,(65280&s.size)>>>8,255&s.size]);return n(U.trun,new Uint8Array(a))},A=function(i,n){return"audio"===i.type?t(i,n):e(i,n)}}(),e.exports={ftyp:s,mdat:o,moof:p,moov:u,initSegment:function(t){var e,i=s(),n=u(t);return e=new Uint8Array(i.byteLength+n.byteLength),e.set(i),e.set(n,i.byteLength),e}}},{}],23:[function(t,e,i){"use strict";var n,a,r,s;n=function(t,e){var i,r,s,o,h,d=[];if(!e.length)return null;for(i=0;i<t.byteLength;)r=t[i]<<24,r|=t[i+1]<<16,r|=t[i+2]<<8,r|=t[i+3],s=a(t.subarray(i+4,i+8)),o=r>1?i+r:t.byteLength,s===e[0]&&(1===e.length?d.push(t.subarray(i+8,o)):(h=n(t.subarray(i+8,o),e.slice(1)),h.length&&(d=d.concat(h)))),i=o;return d},a=function(t){var e="";return e+=String.fromCharCode(t[0]),e+=String.fromCharCode(t[1]),e+=String.fromCharCode(t[2]),e+=String.fromCharCode(t[3])},r=function(t){var e={};return n(t,["moov","trak"]).reduce(function(t,e){var i,a,r,s,o;return(i=n(e,["tkhd"])[0])?(a=i[0],r=0===a?12:20,s=i[r]<<24|i[r+1]<<16|i[r+2]<<8|i[r+3],(o=n(e,["mdia","mdhd"])[0])?(a=o[0],r=0===a?12:20,t[s]=o[r]<<24|o[r+1]<<16|o[r+2]<<8|o[r+3],t):null):null},e)},s=function(t,e){var i,a,r;return i=n(e,["moof","traf"]),a=[].concat.apply([],i.map(function(e){return n(e,["tfhd"]).map(function(i){var a,r,s;return a=i[4]<<24|i[5]<<16|i[6]<<8|i[7],r=t[a]||9e4,s=n(e,["tfdt"]).map(function(t){var e,i;return e=t[0],i=t[4]<<24|t[5]<<16|t[6]<<8|t[7],1===e&&(i*=Math.pow(2,32),i+=t[8]<<24|t[9]<<16|t[10]<<8|t[11]),i})[0],(s=s||1/0)/r})})),r=Math.min.apply(null,a),isFinite(r)?r:0},e.exports={parseType:a,timescale:r,startTime:s}},{}],24:[function(t,e,i){"use strict";var n,a,r,s,o,h,d,p,u,c,l,f=t(30),m=t(22),g=t(16),y=t(3),b=t(4).H264Stream,v=t(1),T=t(6),S=t(28),_=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],w=["width","height","profileIdc","levelIdc","profileCompatibility"];o=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0}}},h=function(t){return t[0]==="I".charCodeAt(0)&&t[1]==="D".charCodeAt(0)&&t[2]==="3".charCodeAt(0)},c=function(t,e){var i;if(t.length!==e.length)return!1;for(i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0},l=function(t){var e,i,n=0;for(e=0;e<t.length;e++)i=t[e],n+=i.data.byteLength;return n},a=function(t){var e=[],i=0,n=0,r=0,s=1/0;a.prototype.init.call(this),this.push=function(i){d(t,i),t&&_.forEach(function(e){t[e]=i[e]}),e.push(i)},this.setEarliestDts=function(e){n=e-t.timelineStartInfo.baseMediaDecodeTime},this.setVideoBaseMediaDecodeTime=function(t){s=t},this.setAudioAppendStart=function(t){r=t},this.flush=function(){var n,a,r,s;if(0===e.length)return void this.trigger("done","AudioSegmentStream");n=this.trimAdtsFramesByEarliestDts_(e),t.baseMediaDecodeTime=u(t),this.prefixWithSilence_(t,n),t.samples=this.generateSampleTable_(n),r=m.mdat(this.concatenateFrameData_(n)),e=[],a=m.moof(i,[t]),s=new Uint8Array(a.byteLength+r.byteLength),i++,s.set(a),s.set(r,a.byteLength),p(t),this.trigger("data",{track:t,boxes:s}),this.trigger("done","AudioSegmentStream")},this.prefixWithSilence_=function(t,e){var i,n,a,o=0,h=0,d=0,p=0;if(e.length&&(i=S.audioTsToVideoTs(t.baseMediaDecodeTime,t.samplerate),o=Math.ceil(9e4/(t.samplerate/1024)),r&&s&&(h=i-Math.max(r,s),d=Math.floor(h/o),p=d*o),!(d<1||p>45e3))){for(n=T[t.samplerate],n||(n=e[0].data),a=0;a<d;a++)e.splice(a,0,{data:n});t.baseMediaDecodeTime-=Math.floor(S.videoTsToAudioTs(p,t.samplerate))}},this.trimAdtsFramesByEarliestDts_=function(e){return t.minSegmentDts>=n?e:(t.minSegmentDts=1/0,e.filter(function(e){return e.dts>=n&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)}))},this.generateSampleTable_=function(t){var e,i,n=[];for(e=0;e<t.length;e++)i=t[e],n.push({size:i.data.byteLength,duration:1024});return n},this.concatenateFrameData_=function(t){var e,i,n=0,a=new Uint8Array(l(t));for(e=0;e<t.length;e++)i=t[e],a.set(i.data,n),n+=i.data.byteLength;return a}},a.prototype=new f,n=function(t,e){var i,a,r=0,s=[],h=[];e=e||{},n.prototype.init.call(this),delete t.minPTS,this.gopCache_=[],this.push=function(e){d(t,e),"seq_parameter_set_rbsp"!==e.nalUnitType||i||(i=e.config,t.sps=[e.data],w.forEach(function(e){t[e]=i[e]},this)),"pic_parameter_set_rbsp"!==e.nalUnitType||a||(a=e.data,t.pps=[e.data]),s.push(e)},this.flush=function(){for(var i,n,a,o,c,l;s.length&&"access_unit_delimiter_rbsp"!==s[0].nalUnitType;)s.shift();if(0===s.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(i=this.groupNalsIntoFrames_(s),a=this.groupFramesIntoGops_(i),a[0][0].keyFrame||(n=this.getGopForFusion_(s[0],t),n?(a.unshift(n),a.byteLength+=n.byteLength,a.nalCount+=n.nalCount,a.pts=n.pts,a.dts=n.dts,a.duration+=n.duration):a=this.extendFirstKeyFrame_(a)),h.length){var f;if(!(f=e.alignGopsAtEnd?this.alignGopsAtEnd_(a):this.alignGopsAtStart_(a)))return this.gopCache_.unshift({gop:a.pop(),pps:t.pps,sps:t.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),s=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");p(t),a=f}d(t,a),t.samples=this.generateSampleTable_(a),c=m.mdat(this.concatenateNalData_(a)),t.baseMediaDecodeTime=u(t),this.trigger("processedGopsInfo",a.map(function(t){return{pts:t.pts,dts:t.dts,byteLength:t.byteLength}})),this.gopCache_.unshift({gop:a.pop(),pps:t.pps,sps:t.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),s=[],this.trigger("baseMediaDecodeTime",t.baseMediaDecodeTime),this.trigger("timelineStartInfo",t.timelineStartInfo),o=m.moof(r,[t]),l=new Uint8Array(o.byteLength+c.byteLength),r++,l.set(o),l.set(c,o.byteLength),this.trigger("data",{track:t,boxes:l}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.resetStream_=function(){p(t),i=void 0,a=void 0},this.getGopForFusion_=function(e){var i,n,a,r,s,o=1/0;for(s=0;s<this.gopCache_.length;s++)r=this.gopCache_[s],a=r.gop,t.pps&&c(t.pps[0],r.pps[0])&&t.sps&&c(t.sps[0],r.sps[0])&&(a.dts<t.timelineStartInfo.dts||(i=e.dts-a.dts-a.duration)>=-1e4&&i<=45e3&&(!n||o>i)&&(n=r,o=i));return n?n.gop:null},this.extendFirstKeyFrame_=function(t){var e;return!t[0][0].keyFrame&&t.length>1&&(e=t.shift(),t.byteLength-=e.byteLength,t.nalCount-=e.nalCount,t[0][0].dts=e.dts,t[0][0].pts=e.pts,t[0][0].duration+=e.duration),t},this.groupNalsIntoFrames_=function(t){var e,i,n=[],a=[];for(n.byteLength=0,e=0;e<t.length;e++)i=t[e],"access_unit_delimiter_rbsp"===i.nalUnitType?(n.length&&(n.duration=i.dts-n.dts,a.push(n)),n=[i],n.byteLength=i.data.byteLength,n.pts=i.pts,n.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(n.keyFrame=!0),n.duration=i.dts-n.dts,n.byteLength+=i.data.byteLength,n.push(i));return a.length&&(!n.duration||n.duration<=0)&&(n.duration=a[a.length-1].duration),a.push(n),a},this.groupFramesIntoGops_=function(t){var e,i,n=[],a=[];for(n.byteLength=0,n.nalCount=0,n.duration=0,n.pts=t[0].pts,n.dts=t[0].dts,a.byteLength=0,a.nalCount=0,a.duration=0,a.pts=t[0].pts,a.dts=t[0].dts,e=0;e<t.length;e++)i=t[e],i.keyFrame?(n.length&&(a.push(n),a.byteLength+=n.byteLength,a.nalCount+=n.nalCount,a.duration+=n.duration),n=[i],n.nalCount=i.length,n.byteLength=i.byteLength,n.pts=i.pts,n.dts=i.dts,n.duration=i.duration):(n.duration+=i.duration,n.nalCount+=i.length,n.byteLength+=i.byteLength,n.push(i));return a.length&&n.duration<=0&&(n.duration=a[a.length-1].duration),a.byteLength+=n.byteLength,a.nalCount+=n.nalCount,a.duration+=n.duration,a.push(n),a},this.generateSampleTable_=function(t,e){var i,n,a,r,s,h=e||0,d=[];for(i=0;i<t.length;i++)for(r=t[i],n=0;n<r.length;n++)s=r[n],a=o(),a.dataOffset=h,a.compositionTimeOffset=s.pts-s.dts,a.duration=s.duration,a.size=4*s.length,a.size+=s.byteLength,s.keyFrame&&(a.flags.dependsOn=2),h+=a.size,d.push(a);return d},this.concatenateNalData_=function(t){var e,i,n,a,r,s,o=0,h=t.byteLength,d=t.nalCount,p=h+4*d,u=new Uint8Array(p),c=new DataView(u.buffer);for(e=0;e<t.length;e++)for(a=t[e],i=0;i<a.length;i++)for(r=a[i],n=0;n<r.length;n++)s=r[n],c.setUint32(o,s.data.byteLength),o+=4,u.set(s.data,o),o+=s.data.byteLength;return u},this.alignGopsAtStart_=function(t){var e,i,n,a,r,s,o,d;for(r=t.byteLength,s=t.nalCount,o=t.duration,e=i=0;e<h.length&&i<t.length&&(n=h[e],a=t[i],n.pts!==a.pts);)a.pts>n.pts?e++:(i++,r-=a.byteLength,s-=a.nalCount,o-=a.duration);return 0===i?t:i===t.length?null:(d=t.slice(i),d.byteLength=r,d.duration=o,d.nalCount=s,d.pts=d[0].pts,d.dts=d[0].dts,d)},this.alignGopsAtEnd_=function(t){var e,i,n,a,r,s;for(e=h.length-1,i=t.length-1,r=null,s=!1;e>=0&&i>=0;){if(n=h[e],a=t[i],n.pts===a.pts){s=!0;break}n.pts>a.pts?e--:(e===h.length-1&&(r=i),i--)}if(!s&&null===r)return null;var o;if(0===(o=s?i:r))return t;var d=t.slice(o),p=d.reduce(function(t,e){return t.byteLength+=e.byteLength,t.duration+=e.duration,t.nalCount+=e.nalCount,t},{byteLength:0,duration:0,nalCount:0});return d.byteLength=p.byteLength,d.duration=p.duration,d.nalCount=p.nalCount,d.pts=d[0].pts,d.dts=d[0].dts,d},this.alignGopsWith=function(t){h=t}},n.prototype=new f,d=function(t,e){"number"==typeof e.pts&&(void 0===t.timelineStartInfo.pts&&(t.timelineStartInfo.pts=e.pts),void 0===t.minSegmentPts?t.minSegmentPts=e.pts:t.minSegmentPts=Math.min(t.minSegmentPts,e.pts),void 0===t.maxSegmentPts?t.maxSegmentPts=e.pts:t.maxSegmentPts=Math.max(t.maxSegmentPts,e.pts)),"number"==typeof e.dts&&(void 0===t.timelineStartInfo.dts&&(t.timelineStartInfo.dts=e.dts),void 0===t.minSegmentDts?t.minSegmentDts=e.dts:t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),void 0===t.maxSegmentDts?t.maxSegmentDts=e.dts:t.maxSegmentDts=Math.max(t.maxSegmentDts,e.dts))},p=function(t){delete t.minSegmentDts,delete t.maxSegmentDts,delete t.minSegmentPts,delete t.maxSegmentPts},u=function(t){var e,i,n=t.minSegmentDts-t.timelineStartInfo.dts;return e=t.timelineStartInfo.baseMediaDecodeTime,e+=n,e=Math.max(0,e),"audio"===t.type&&(i=t.samplerate/9e4,e*=i,e=Math.floor(e)),e},s=function(t,e){this.numberOfTracks=0,this.metadataStream=e,void 0!==t.remux?this.remuxTracks=!!t.remux:this.remuxTracks=!0,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,s.prototype.init.call(this),this.push=function(t){return t.text?this.pendingCaptions.push(t):t.frames?this.pendingMetadata.push(t):(this.pendingTracks.push(t.track),this.pendingBoxes.push(t.boxes),this.pendingBytes+=t.boxes.byteLength,"video"===t.track.type&&(this.videoTrack=t.track),void("audio"===t.track.type&&(this.audioTrack=t.track)))}},s.prototype=new f,s.prototype.flush=function(t){var e,i,n,a,r=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==t&&"AudioSegmentStream"!==t)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return void(++this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}for(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,w.forEach(function(t){s.info[t]=this.videoTrack[t]},this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,_.forEach(function(t){s.info[t]=this.audioTrack[t]},this)),1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=m.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),a=0;a<this.pendingBoxes.length;a++)s.data.set(this.pendingBoxes[a],r),r+=this.pendingBoxes[a].byteLength;for(a=0;a<this.pendingCaptions.length;a++)e=this.pendingCaptions[a],e.startTime=e.startPts-o,e.startTime/=9e4,e.endTime=e.endPts-o,e.endTime/=9e4,s.captionStreams[e.stream]=!0,s.captions.push(e);for(a=0;a<this.pendingMetadata.length;a++)i=this.pendingMetadata[a],i.cueTime=i.pts-o,i.cueTime/=9e4,s.metadata.push(i);s.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",s),this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},r=function(t){var e,i,o=this,d=!0;r.prototype.init.call(this),t=t||{},this.baseMediaDecodeTime=t.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var e={};this.transmuxPipeline_=e,e.type="aac",e.metadataStream=new g.MetadataStream,e.aacStream=new v,e.audioTimestampRolloverStream=new g.TimestampRolloverStream("audio"),e.timedMetadataTimestampRolloverStream=new g.TimestampRolloverStream("timed-metadata"),e.adtsStream=new y,e.coalesceStream=new s(t,e.metadataStream),e.headOfPipeline=e.aacStream,e.aacStream.pipe(e.audioTimestampRolloverStream).pipe(e.adtsStream),e.aacStream.pipe(e.timedMetadataTimestampRolloverStream).pipe(e.metadataStream).pipe(e.coalesceStream),e.metadataStream.on("timestamp",function(t){e.aacStream.setTimestamp(t.timeStamp)}),e.aacStream.on("data",function(t){"timed-metadata"!==t.type||e.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:o.baseMediaDecodeTime},codec:"adts",type:"audio"},e.coalesceStream.numberOfTracks++,e.audioSegmentStream=new a(i),e.adtsStream.pipe(e.audioSegmentStream).pipe(e.coalesceStream))}),e.coalesceStream.on("data",this.trigger.bind(this,"data")),e.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="ts",r.metadataStream=new g.MetadataStream,r.packetStream=new g.TransportPacketStream,r.parseStream=new g.TransportParseStream,r.elementaryStream=new g.ElementaryStream,r.videoTimestampRolloverStream=new g.TimestampRolloverStream("video"),r.audioTimestampRolloverStream=new g.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new g.TimestampRolloverStream("timed-metadata"),r.adtsStream=new y,r.h264Stream=new b,r.captionStream=new g.CaptionStream,r.coalesceStream=new s(t,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream),r.elementaryStream.pipe(r.videoTimestampRolloverStream).pipe(r.h264Stream),r.elementaryStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.elementaryStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",function(s){var h;if("metadata"===s.type){for(h=s.tracks.length;h--;)e||"video"!==s.tracks[h].type?i||"audio"!==s.tracks[h].type||(i=s.tracks[h],i.timelineStartInfo.baseMediaDecodeTime=o.baseMediaDecodeTime):(e=s.tracks[h],e.timelineStartInfo.baseMediaDecodeTime=o.baseMediaDecodeTime);e&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new n(e,t),r.videoSegmentStream.on("timelineStartInfo",function(t){i&&(i.timelineStartInfo=t,r.audioSegmentStream.setEarliestDts(t.dts))}),r.videoSegmentStream.on("processedGopsInfo",o.trigger.bind(o,"gopInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",function(t){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(t)}),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new a(i),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream))}}),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(t){var n=this.transmuxPipeline_;this.baseMediaDecodeTime=t,i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,p(i),i.timelineStartInfo.baseMediaDecodeTime=t,n.audioTimestampRolloverStream&&n.audioTimestampRolloverStream.discontinuity()),e&&(n.videoSegmentStream&&(n.videoSegmentStream.gopCache_=[],n.videoTimestampRolloverStream.discontinuity()),e.timelineStartInfo.dts=void 0,e.timelineStartInfo.pts=void 0,p(e),n.captionStream.reset(),e.timelineStartInfo.baseMediaDecodeTime=t),n.timedMetadataTimestampRolloverStream&&n.timedMetadataTimestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(t){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(t)},this.alignGopsWith=function(t){e&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(t)},this.push=function(t){if(d){var e=h(t);e&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():e||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),d=!1}this.transmuxPipeline_.headOfPipeline.push(t)},this.flush=function(){d=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},r.prototype=new f,e.exports={Transmuxer:r,VideoSegmentStream:n,AudioSegmentStream:a,AUDIO_PROPERTIES:_,VIDEO_PROPERTIES:w}},{}],25:[function(t,e,i){"use strict";var n={8:"audio",9:"video",18:"metadata"},a=function(t){return"0x"+("00"+t.toString(16)).slice(-2).toUpperCase()},r=function(t){for(var e,i=[];t.byteLength>0;)e=0,i.push(a(t[e++])),t=t.subarray(e);return i.join(" ")},s=function(t,e){var i=["AVC Sequence Header","AVC NALU","AVC End-of-Sequence"],n=t[1]&parseInt("01111111",2)<<16|t[2]<<8|t[3];return e=e||{},e.avcPacketType=i[t[0]],e.CompositionTime=t[1]&parseInt("10000000",2)?-n:n,1===t[0]?e.nalUnitTypeRaw=r(t.subarray(4,100)):e.data=r(t.subarray(4)),e},o=function(t,e){var i=["Unknown","Keyframe (for AVC, a seekable frame)","Inter frame (for AVC, a nonseekable frame)","Disposable inter frame (H.263 only)","Generated keyframe (reserved for server use only)","Video info/command frame"],n=t[0]&parseInt("00001111",2);return e=e||{},e.frameType=i[(t[0]&parseInt("11110000",2))>>>4],e.codecID=n,7===n?s(t.subarray(1),e):e},h=function(t,e){var i=["AAC Sequence Header","AAC Raw"];return e=e||{},e.aacPacketType=i[t[0]],e.data=r(t.subarray(1)),e},d=function(t,e){var i=["Linear PCM, platform endian","ADPCM","MP3","Linear PCM, little endian","Nellymoser 16-kHz mono","Nellymoser 8-kHz mono","Nellymoser","G.711 A-law logarithmic PCM","G.711 mu-law logarithmic PCM","reserved","AAC","Speex","MP3 8-Khz","Device-specific sound"],n=["5.5-kHz","11-kHz","22-kHz","44-kHz"],a=(t[0]&parseInt("11110000",2))>>>4;return e=e||{},e.soundFormat=i[a],e.soundRate=n[(t[0]&parseInt("00001100",2))>>>2],e.soundSize=(t[0]&parseInt("00000010",2))>>>1?"16-bit":"8-bit",e.soundType=t[0]&parseInt("00000001",2)?"Stereo":"Mono",10===a?h(t.subarray(1),e):e},p=function(t){return{tagType:n[t[0]],dataSize:t[1]<<16|t[2]<<8|t[3],timestamp:t[7]<<24|t[4]<<16|t[5]<<8|t[6],streamID:t[8]<<16|t[9]<<8|t[10]}},u=function(t){var e=p(t);switch(t[0]){case 8:d(t.subarray(11),e);break;case 9:o(t.subarray(11),e)}return e},c=function(t){var e,i,n=9,a=[];for(n+=4;n<t.byteLength;)e=t[n+1]<<16,e|=t[n+2]<<8,e|=t[n+3],e+=11,i=t.subarray(n,n+e),a.push(u(i)),n+=e+4
;return a},l=function(t){return JSON.stringify(t,null,2)};e.exports={inspectTag:u,inspect:c,textify:l}},{}],26:[function(t,e,i){(function(i){"use strict";var n,a,r=t(23).parseType,s=function(t){return new Date(1e3*t-20828448e5)},o=function(t){return{isLeading:(12&t[0])>>>2,dependsOn:3&t[0],isDependedOn:(192&t[1])>>>6,hasRedundancy:(48&t[1])>>>4,paddingValue:(14&t[1])>>>1,isNonSyncSample:1&t[1],degradationPriority:t[2]<<8|t[3]}},h=function(t){var e,i,n=new DataView(t.buffer,t.byteOffset,t.byteLength),a=[];for(e=0;e+4<t.length;e+=i)if(i=n.getUint32(e),e+=4,i<=0)a.push("<span style='color:red;'>MALFORMED DATA</span>");else switch(31&t[e]){case 1:a.push("slice_layer_without_partitioning_rbsp");break;case 5:a.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:a.push("sei_rbsp");break;case 7:a.push("seq_parameter_set_rbsp");break;case 8:a.push("pic_parameter_set_rbsp");break;case 9:a.push("access_unit_delimiter_rbsp");break;default:a.push("UNKNOWN NAL - "+t[e]&31)}return a},d={avc1:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{dataReferenceIndex:e.getUint16(6),width:e.getUint16(24),height:e.getUint16(26),horizresolution:e.getUint16(28)+e.getUint16(30)/16,vertresolution:e.getUint16(32)+e.getUint16(34)/16,frameCount:e.getUint16(40),depth:e.getUint16(74),config:n(t.subarray(78,t.byteLength))}},avcC:function(t){var e,i,n,a,r=new DataView(t.buffer,t.byteOffset,t.byteLength),s={configurationVersion:t[0],avcProfileIndication:t[1],profileCompatibility:t[2],avcLevelIndication:t[3],lengthSizeMinusOne:3&t[4],sps:[],pps:[]},o=31&t[5];for(n=6,a=0;a<o;a++)i=r.getUint16(n),n+=2,s.sps.push(new Uint8Array(t.subarray(n,n+i))),n+=i;for(e=t[n],n++,a=0;a<e;a++)i=r.getUint16(n),n+=2,s.pps.push(new Uint8Array(t.subarray(n,n+i))),n+=i;return s},btrt:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{bufferSizeDB:e.getUint32(0),maxBitrate:e.getUint32(4),avgBitrate:e.getUint32(8)}},esds:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),esId:t[6]<<8|t[7],streamPriority:31&t[8],decoderConfig:{objectProfileIndication:t[11],streamType:t[12]>>>2&63,bufferSize:t[13]<<16|t[14]<<8|t[15],maxBitrate:t[16]<<24|t[17]<<16|t[18]<<8|t[19],avgBitrate:t[20]<<24|t[21]<<16|t[22]<<8|t[23],decoderConfigDescriptor:{tag:t[24],length:t[25],audioObjectType:t[26]>>>3&31,samplingFrequencyIndex:(7&t[26])<<1|t[27]>>>7&1,channelConfiguration:t[27]>>>3&15}}}},ftyp:function(t){for(var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={majorBrand:r(t.subarray(0,4)),minorVersion:e.getUint32(4),compatibleBrands:[]},n=8;n<t.byteLength;)i.compatibleBrands.push(r(t.subarray(n,n+4))),n+=4;return i},dinf:function(t){return{boxes:n(t)}},dref:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),dataReferences:n(t.subarray(8))}},hdlr:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),handlerType:r(t.subarray(8,12)),name:""},a=8;for(a=24;a<t.byteLength;a++){if(0===t[a]){a++;break}n.name+=String.fromCharCode(t[a])}return n.name=decodeURIComponent(i.escape(n.name)),n},mdat:function(t){return{byteLength:t.byteLength,nals:h(t)}},mdhd:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n=4,a={version:i.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),language:""};return 1===a.version?(n+=4,a.creationTime=s(i.getUint32(n)),n+=8,a.modificationTime=s(i.getUint32(n)),n+=4,a.timescale=i.getUint32(n),n+=8,a.duration=i.getUint32(n)):(a.creationTime=s(i.getUint32(n)),n+=4,a.modificationTime=s(i.getUint32(n)),n+=4,a.timescale=i.getUint32(n),n+=4,a.duration=i.getUint32(n)),n+=4,e=i.getUint16(n),a.language+=String.fromCharCode(96+(e>>10)),a.language+=String.fromCharCode(96+((960&e)>>5)),a.language+=String.fromCharCode(96+(31&e)),a},mdia:function(t){return{boxes:n(t)}},mfhd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),sequenceNumber:t[4]<<24|t[5]<<16|t[6]<<8|t[7]}},minf:function(t){return{boxes:n(t)}},mp4a:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={dataReferenceIndex:e.getUint16(6),channelcount:e.getUint16(16),samplesize:e.getUint16(18),samplerate:e.getUint16(24)+e.getUint16(26)/65536};return t.byteLength>28&&(i.streamDescriptor=n(t.subarray(28))[0]),i},moof:function(t){return{boxes:n(t)}},moov:function(t){return{boxes:n(t)}},mvex:function(t){return{boxes:n(t)}},mvhd:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i=4,n={version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4))};return 1===n.version?(i+=4,n.creationTime=s(e.getUint32(i)),i+=8,n.modificationTime=s(e.getUint32(i)),i+=4,n.timescale=e.getUint32(i),i+=8,n.duration=e.getUint32(i)):(n.creationTime=s(e.getUint32(i)),i+=4,n.modificationTime=s(e.getUint32(i)),i+=4,n.timescale=e.getUint32(i),i+=4,n.duration=e.getUint32(i)),i+=4,n.rate=e.getUint16(i)+e.getUint16(i+2)/16,i+=4,n.volume=e.getUint8(i)+e.getUint8(i+1)/8,i+=2,i+=2,i+=8,n.matrix=new Uint32Array(t.subarray(i,i+36)),i+=36,i+=24,n.nextTrackId=e.getUint32(i),n},pdin:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),rate:e.getUint32(4),initialDelay:e.getUint32(8)}},sdtp:function(t){var e,i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]};for(e=4;e<t.byteLength;e++)i.samples.push({dependsOn:(48&t[e])>>4,isDependedOn:(12&t[e])>>2,hasRedundancy:3&t[e]});return i},sidx:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8),earliestPresentationTime:i.getUint32(12),firstOffset:i.getUint32(16)},a=i.getUint16(22);for(e=24;a;e+=12,a--)n.references.push({referenceType:(128&t[e])>>>7,referencedSize:2147483647&i.getUint32(e),subsegmentDuration:i.getUint32(e+4),startsWithSap:!!(128&t[e+8]),sapType:(112&t[e+8])>>>4,sapDeltaTime:268435455&i.getUint32(e+8)});return n},smhd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),balance:t[4]+t[5]/256}},stbl:function(t){return{boxes:n(t)}},stco:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),chunkOffsets:[]},a=i.getUint32(4);for(e=8;a;e+=4,a--)n.chunkOffsets.push(i.getUint32(e));return n},stsc:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n=i.getUint32(4),a={version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleToChunks:[]};for(e=8;n;e+=12,n--)a.sampleToChunks.push({firstChunk:i.getUint32(e),samplesPerChunk:i.getUint32(e+4),sampleDescriptionIndex:i.getUint32(e+8)});return a},stsd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleDescriptions:n(t.subarray(8))}},stsz:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleSize:i.getUint32(4),entries:[]};for(e=12;e<t.byteLength;e+=4)n.entries.push(i.getUint32(e));return n},stts:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),timeToSamples:[]},a=i.getUint32(4);for(e=8;a;e+=8,a--)n.timeToSamples.push({sampleCount:i.getUint32(e),sampleDelta:i.getUint32(e+4)});return n},styp:function(t){return d.ftyp(t)},tfdt:function(t){var e={version:t[0],flags:new Uint8Array(t.subarray(1,4)),baseMediaDecodeTime:t[4]<<24|t[5]<<16|t[6]<<8|t[7]};return 1===e.version&&(e.baseMediaDecodeTime*=Math.pow(2,32),e.baseMediaDecodeTime+=t[8]<<24|t[9]<<16|t[10]<<8|t[11]),e},tfhd:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),trackId:i.getUint32(4)},a=1&n.flags[2],r=2&n.flags[2],s=8&n.flags[2],o=16&n.flags[2],h=32&n.flags[2];return e=8,a&&(e+=4,n.baseDataOffset=i.getUint32(12),e+=4),r&&(n.sampleDescriptionIndex=i.getUint32(e),e+=4),s&&(n.defaultSampleDuration=i.getUint32(e),e+=4),o&&(n.defaultSampleSize=i.getUint32(e),e+=4),h&&(n.defaultSampleFlags=i.getUint32(e)),n},tkhd:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i=4,n={version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4))};return 1===n.version?(i+=4,n.creationTime=s(e.getUint32(i)),i+=8,n.modificationTime=s(e.getUint32(i)),i+=4,n.trackId=e.getUint32(i),i+=4,i+=8,n.duration=e.getUint32(i)):(n.creationTime=s(e.getUint32(i)),i+=4,n.modificationTime=s(e.getUint32(i)),i+=4,n.trackId=e.getUint32(i),i+=4,i+=4,n.duration=e.getUint32(i)),i+=4,i+=8,n.layer=e.getUint16(i),i+=2,n.alternateGroup=e.getUint16(i),i+=2,n.volume=e.getUint8(i)+e.getUint8(i+1)/8,i+=2,i+=2,n.matrix=new Uint32Array(t.subarray(i,i+36)),i+=36,n.width=e.getUint16(i)+e.getUint16(i+2)/16,i+=4,n.height=e.getUint16(i)+e.getUint16(i+2)/16,n},traf:function(t){return{boxes:n(t)}},trak:function(t){return{boxes:n(t)}},trex:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),trackId:e.getUint32(4),defaultSampleDescriptionIndex:e.getUint32(8),defaultSampleDuration:e.getUint32(12),defaultSampleSize:e.getUint32(16),sampleDependsOn:3&t[20],sampleIsDependedOn:(192&t[21])>>6,sampleHasRedundancy:(48&t[21])>>4,samplePaddingValue:(14&t[21])>>1,sampleIsDifferenceSample:!!(1&t[21]),sampleDegradationPriority:e.getUint16(22)}},trun:function(t){var e,i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]},n=new DataView(t.buffer,t.byteOffset,t.byteLength),a=1&i.flags[2],r=4&i.flags[2],s=1&i.flags[1],h=2&i.flags[1],d=4&i.flags[1],p=8&i.flags[1],u=n.getUint32(4),c=8;for(a&&(i.dataOffset=n.getUint32(c),c+=4),r&&u&&(e={flags:o(t.subarray(c,c+4))},c+=4,s&&(e.duration=n.getUint32(c),c+=4),h&&(e.size=n.getUint32(c),c+=4),p&&(e.compositionTimeOffset=n.getUint32(c),c+=4),i.samples.push(e),u--);u--;)e={},s&&(e.duration=n.getUint32(c),c+=4),h&&(e.size=n.getUint32(c),c+=4),d&&(e.flags=o(t.subarray(c,c+4)),c+=4),p&&(e.compositionTimeOffset=n.getUint32(c),c+=4),i.samples.push(e);return i},"url ":function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4))}},vmhd:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),graphicsmode:e.getUint16(4),opcolor:new Uint16Array([e.getUint16(6),e.getUint16(8),e.getUint16(10)])}}};n=function(t){for(var e,i,n,a,s,o=0,h=[],p=new ArrayBuffer(t.length),u=new Uint8Array(p),c=0;c<t.length;++c)u[c]=t[c];for(e=new DataView(p);o<t.byteLength;)i=e.getUint32(o),n=r(t.subarray(o+4,o+8)),a=i>1?o+i:t.byteLength,s=(d[n]||function(t){return{data:t}})(t.subarray(o+8,a)),s.size=i,s.type=n,h.push(s),o=a;return h},a=function(t,e){var i;return e=e||0,i=new Array(2*e+1).join(" "),t.map(function(t,n){return i+t.type+"\n"+Object.keys(t).filter(function(t){return"type"!==t&&"boxes"!==t}).map(function(e){var n=i+" "+e+": ",a=t[e];if(a instanceof Uint8Array||a instanceof Uint32Array){var r=Array.prototype.slice.call(new Uint8Array(a.buffer,a.byteOffset,a.byteLength)).map(function(t){return" "+("00"+t.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);return r?1===r.length?n+"<"+r.join("").slice(1)+">":n+"<\n"+r.map(function(t){return i+" "+t}).join("\n")+"\n"+i+" >":n+"<>"}return n+JSON.stringify(a,null,2).split("\n").map(function(t,e){return 0===e?t:i+" "+t}).join("\n")}).join("\n")+(t.boxes?"\n"+a(t.boxes,e+1):"")}).join("\n")},e.exports={inspect:n,textify:a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],27:[function(t,e,i){"use strict";var n=t(19),a=t(20).handleRollover,r={};r.ts=t(18),r.aac=t(2);var s=function(t){return t[0]==="I".charCodeAt(0)&&t[1]==="D".charCodeAt(0)&&t[2]==="3".charCodeAt(0)},o=function(t,e){for(var i,n=0,a=188;a<t.byteLength;)if(71!==t[n]||71!==t[a])n++,a++;else{switch(i=t.subarray(n,a),r.ts.parseType(i,e.pid)){case"pat":e.pid||(e.pid=r.ts.parsePat(i));break;case"pmt":e.table||(e.table=r.ts.parsePmt(i))}if(e.pid&&e.table)return;n+=188,a+=188}},h=function(t,e,i){for(var n,a,s,o,h=0,d=188,p=!1;d<t.byteLength;)if(71!==t[h]||71!==t[d])h++,d++;else{switch(n=t.subarray(h,d),r.ts.parseType(n,e.pid)){case"pes":a=r.ts.parsePesType(n,e.table),s=r.ts.parsePayloadUnitStartIndicator(n),"audio"===a&&s&&(o=r.ts.parsePesTime(n))&&(o.type="audio",i.audio.push(o),p=!0)}if(p)break;h+=188,d+=188}for(d=t.byteLength,h=d-188,p=!1;h>=0;)if(71!==t[h]||71!==t[d])h--,d--;else{switch(n=t.subarray(h,d),r.ts.parseType(n,e.pid)){case"pes":a=r.ts.parsePesType(n,e.table),s=r.ts.parsePayloadUnitStartIndicator(n),"audio"===a&&s&&(o=r.ts.parsePesTime(n))&&(o.type="audio",i.audio.push(o),p=!0)}if(p)break;h-=188,d-=188}},d=function(t,e,i){for(var n,a,s,o,h,d,p,u=0,c=188,l=!1,f={data:[],size:0};c<t.byteLength;)if(71!==t[u]||71!==t[c])u++,c++;else{switch(n=t.subarray(u,c),r.ts.parseType(n,e.pid)){case"pes":if(a=r.ts.parsePesType(n,e.table),s=r.ts.parsePayloadUnitStartIndicator(n),"video"===a&&(s&&!l&&(o=r.ts.parsePesTime(n))&&(o.type="video",i.video.push(o),l=!0),!i.firstKeyFrame)){if(s&&0!==f.size){for(h=new Uint8Array(f.size),d=0;f.data.length;)p=f.data.shift(),h.set(p,d),d+=p.byteLength;r.ts.videoPacketContainsKeyFrame(h)&&(i.firstKeyFrame=r.ts.parsePesTime(h),i.firstKeyFrame.type="video"),f.size=0}f.data.push(n),f.size+=n.byteLength}}if(l&&i.firstKeyFrame)break;u+=188,c+=188}for(c=t.byteLength,u=c-188,l=!1;u>=0;)if(71!==t[u]||71!==t[c])u--,c--;else{switch(n=t.subarray(u,c),r.ts.parseType(n,e.pid)){case"pes":a=r.ts.parsePesType(n,e.table),s=r.ts.parsePayloadUnitStartIndicator(n),"video"===a&&s&&(o=r.ts.parsePesTime(n))&&(o.type="video",i.video.push(o),l=!0)}if(l)break;u-=188,c-=188}},p=function(t,e){if(t.audio&&t.audio.length){var i=e;void 0===i&&(i=t.audio[0].dts),t.audio.forEach(function(t){t.dts=a(t.dts,i),t.pts=a(t.pts,i),t.dtsTime=t.dts/9e4,t.ptsTime=t.pts/9e4})}if(t.video&&t.video.length){var n=e;if(void 0===n&&(n=t.video[0].dts),t.video.forEach(function(t){t.dts=a(t.dts,n),t.pts=a(t.pts,n),t.dtsTime=t.dts/9e4,t.ptsTime=t.pts/9e4}),t.firstKeyFrame){var r=t.firstKeyFrame;r.dts=a(r.dts,n),r.pts=a(r.pts,n),r.dtsTime=r.dts/9e4,r.ptsTime=r.dts/9e4}}},u=function(t){for(var e,i=!1,n=0,a=null,s=null,o=0,h=0;t.length-h>=3;){switch(r.aac.parseType(t,h)){case"timed-metadata":if(t.length-h<10){i=!0;break}if((o=r.aac.parseId3TagSize(t,h))>t.length){i=!0;break}null===s&&(e=t.subarray(h,h+o),s=r.aac.parseAacTimestamp(e)),h+=o;break;case"audio":if(t.length-h<7){i=!0;break}if((o=r.aac.parseAdtsSize(t,h))>t.length){i=!0;break}null===a&&(e=t.subarray(h,h+o),a=r.aac.parseSampleRate(e)),n++,h+=o;break;default:h++}if(i)return null}if(null===a||null===s)return null;var d=9e4/a;return{audio:[{type:"audio",dts:s,pts:s},{type:"audio",dts:s+1024*n*d,pts:s+1024*n*d}]}},c=function(t){var e={pid:null,table:null},i={};o(t,e);for(var a in e.table)if(e.table.hasOwnProperty(a)){var r=e.table[a];switch(r){case n.H264_STREAM_TYPE:i.video=[],d(t,e,i),0===i.video.length&&delete i.video;break;case n.ADTS_STREAM_TYPE:i.audio=[],h(t,e,i),0===i.audio.length&&delete i.audio}}return i},l=function(t,e){var i,n=s(t);return(i=n?u(t):c(t))&&(i.audio||i.video)?(p(i,e),i):null};e.exports={inspect:l}},{}],28:[function(t,e,i){var n,a,r,s,o,h;n=function(t){return 9e4*t},a=function(t,e){return t*e},r=function(t){return t/9e4},s=function(t,e){return t/e},o=function(t,e){return n(s(t,e))},h=function(t,e){return a(r(t),e)},e.exports={secondsToVideoTs:n,secondsToAudioTs:a,videoTsToSeconds:r,audioTsToSeconds:s,audioTsToVideoTs:o,videoTsToAudioTs:h}},{}],29:[function(t,e,i){"use strict";var n;n=function(t){var e=t.byteLength,i=0,n=0;this.length=function(){return 8*e},this.bitsAvailable=function(){return 8*e+n},this.loadWord=function(){var a=t.byteLength-e,r=new Uint8Array(4),s=Math.min(4,e);if(0===s)throw new Error("no bytes available");r.set(t.subarray(a,a+s)),i=new DataView(r.buffer).getUint32(0),n=8*s,e-=s},this.skipBits=function(t){var a;n>t?(i<<=t,n-=t):(t-=n,a=Math.floor(t/8),t-=8*a,e-=a,this.loadWord(),i<<=t,n-=t)},this.readBits=function(t){var a=Math.min(n,t),r=i>>>32-a;return n-=a,n>0?i<<=a:e>0&&this.loadWord(),a=t-a,a>0?r<<a|this.readBits(a):r},this.skipLeadingZeros=function(){var t;for(t=0;t<n;++t)if(0!=(i&2147483648>>>t))return i<<=t,n-=t,t;return this.loadWord(),t+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var t=this.skipLeadingZeros();return this.readBits(t+1)-1},this.readExpGolomb=function(){var t=this.readUnsignedExpGolomb();return 1&t?1+t>>>1:-1*(t>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()},e.exports=n},{}],30:[function(t,e,i){"use strict";var n=function(){this.init=function(){var t={};this.on=function(e,i){t[e]||(t[e]=[]),t[e]=t[e].concat(i)},this.off=function(e,i){var n;return!!t[e]&&(n=t[e].indexOf(i),t[e]=t[e].slice(),t[e].splice(n,1),n>-1)},this.trigger=function(e){var i,n,a,r;if(i=t[e])if(2===arguments.length)for(a=i.length,n=0;n<a;++n)i[n].call(this,arguments[1]);else{for(r=[],n=arguments.length,n=1;n<arguments.length;++n)r.push(arguments[n]);for(a=i.length,n=0;n<a;++n)i[n].apply(this,r)}},this.dispose=function(){t={}}}};n.prototype.pipe=function(t){return this.on("data",function(e){t.push(e)}),this.on("done",function(e){t.flush(e)}),t},n.prototype.push=function(t){this.trigger("data",t)},n.prototype.flush=function(t){this.trigger("done",t)},e.exports=n},{}]},{},[13]);