@libmedia/avplayer 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/163.avplayer.js +1 -0
- package/dist/esm/182.avplayer.js +1 -0
- package/dist/esm/195.avplayer.js +1 -0
- package/dist/esm/199.avplayer.js +1 -0
- package/dist/esm/239.avplayer.js +1 -0
- package/dist/esm/248.avplayer.js +1 -0
- package/dist/esm/26.avplayer.js +1 -0
- package/dist/esm/261.avplayer.js +1 -0
- package/dist/esm/272.avplayer.js +1 -1
- package/dist/esm/325.avplayer.js +1 -0
- package/dist/esm/33.avplayer.js +1 -0
- package/dist/esm/384.avplayer.js +1 -0
- package/dist/esm/43.avplayer.js +1 -0
- package/dist/esm/462.avplayer.js +1 -0
- package/dist/esm/502.avplayer.js +1 -0
- package/dist/esm/573.avplayer.js +1 -0
- package/dist/esm/630.avplayer.js +1 -0
- package/dist/esm/641.avplayer.js +1 -0
- package/dist/esm/735.avplayer.js +1 -0
- package/dist/esm/747.avplayer.js +1 -0
- package/dist/esm/749.avplayer.js +1 -0
- package/dist/esm/790.avplayer.js +1 -0
- package/dist/esm/794.avplayer.js +1 -0
- package/dist/esm/850.avplayer.js +1 -0
- package/dist/esm/881.avplayer.js +1 -0
- package/dist/esm/932.avplayer.js +1 -0
- package/dist/esm/943.avplayer.js +1 -0
- package/dist/esm/956.avplayer.js +1 -0
- package/dist/esm/961.avplayer.js +1 -0
- package/dist/esm/97.avplayer.js +1 -0
- package/dist/esm/991.avplayer.js +1 -0
- package/dist/esm/avplayer.js +1 -1
- package/dist/types/src/AVPlayer.d.ts +10 -10
- package/dist/types/src/drm/getKeySystemFromSystemId.d.ts +1 -1
- package/dist/types/src/type.d.ts +1 -1
- package/dist/umd/163.avplayer.js +1 -0
- package/dist/umd/182.avplayer.js +1 -0
- package/dist/umd/195.avplayer.js +1 -0
- package/dist/umd/199.avplayer.js +1 -0
- package/dist/umd/239.avplayer.js +1 -0
- package/dist/umd/248.avplayer.js +1 -0
- package/dist/umd/26.avplayer.js +1 -0
- package/dist/umd/261.avplayer.js +1 -0
- package/dist/umd/272.avplayer.js +1 -1
- package/dist/umd/325.avplayer.js +1 -0
- package/dist/umd/33.avplayer.js +1 -0
- package/dist/umd/384.avplayer.js +1 -0
- package/dist/umd/43.avplayer.js +1 -0
- package/dist/umd/462.avplayer.js +1 -0
- package/dist/umd/502.avplayer.js +1 -0
- package/dist/umd/573.avplayer.js +1 -0
- package/dist/umd/630.avplayer.js +1 -0
- package/dist/umd/641.avplayer.js +1 -0
- package/dist/umd/735.avplayer.js +1 -0
- package/dist/umd/747.avplayer.js +1 -0
- package/dist/umd/749.avplayer.js +1 -0
- package/dist/umd/790.avplayer.js +1 -0
- package/dist/umd/794.avplayer.js +1 -0
- package/dist/umd/850.avplayer.js +1 -0
- package/dist/umd/881.avplayer.js +1 -0
- package/dist/umd/932.avplayer.js +1 -0
- package/dist/umd/943.avplayer.js +1 -0
- package/dist/umd/956.avplayer.js +1 -0
- package/dist/umd/961.avplayer.js +1 -0
- package/dist/umd/97.avplayer.js +1 -0
- package/dist/umd/991.avplayer.js +1 -0
- package/dist/umd/avplayer.js +1 -1
- package/package.json +16 -15
- package/dist/esm/1.avplayer.js +0 -1
- package/dist/esm/134.avplayer.js +0 -1
- package/dist/esm/158.avplayer.js +0 -1
- package/dist/esm/236.avplayer.js +0 -1
- package/dist/esm/243.avplayer.js +0 -1
- package/dist/esm/265.avplayer.js +0 -1
- package/dist/esm/276.avplayer.js +0 -1
- package/dist/esm/29.avplayer.js +0 -1
- package/dist/esm/293.avplayer.js +0 -1
- package/dist/esm/351.avplayer.js +0 -1
- package/dist/esm/383.avplayer.js +0 -1
- package/dist/esm/426.avplayer.js +0 -1
- package/dist/esm/434.avplayer.js +0 -1
- package/dist/esm/471.avplayer.js +0 -1
- package/dist/esm/473.avplayer.js +0 -1
- package/dist/esm/484.avplayer.js +0 -1
- package/dist/esm/519.avplayer.js +0 -1
- package/dist/esm/520.avplayer.js +0 -1
- package/dist/esm/521.avplayer.js +0 -1
- package/dist/esm/561.avplayer.js +0 -1
- package/dist/esm/625.avplayer.js +0 -1
- package/dist/esm/634.avplayer.js +0 -1
- package/dist/esm/652.avplayer.js +0 -1
- package/dist/esm/724.avplayer.js +0 -1
- package/dist/esm/726.avplayer.js +0 -1
- package/dist/esm/728.avplayer.js +0 -1
- package/dist/esm/765.avplayer.js +0 -1
- package/dist/esm/779.avplayer.js +0 -1
- package/dist/esm/888.avplayer.js +0 -1
- package/dist/esm/931.avplayer.js +0 -1
- package/dist/esm/967.avplayer.js +0 -1
- package/dist/umd/1.avplayer.js +0 -1
- package/dist/umd/134.avplayer.js +0 -1
- package/dist/umd/158.avplayer.js +0 -1
- package/dist/umd/236.avplayer.js +0 -1
- package/dist/umd/243.avplayer.js +0 -1
- package/dist/umd/265.avplayer.js +0 -1
- package/dist/umd/276.avplayer.js +0 -1
- package/dist/umd/29.avplayer.js +0 -1
- package/dist/umd/293.avplayer.js +0 -1
- package/dist/umd/351.avplayer.js +0 -1
- package/dist/umd/383.avplayer.js +0 -1
- package/dist/umd/426.avplayer.js +0 -1
- package/dist/umd/434.avplayer.js +0 -1
- package/dist/umd/471.avplayer.js +0 -1
- package/dist/umd/473.avplayer.js +0 -1
- package/dist/umd/484.avplayer.js +0 -1
- package/dist/umd/519.avplayer.js +0 -1
- package/dist/umd/520.avplayer.js +0 -1
- package/dist/umd/521.avplayer.js +0 -1
- package/dist/umd/561.avplayer.js +0 -1
- package/dist/umd/625.avplayer.js +0 -1
- package/dist/umd/634.avplayer.js +0 -1
- package/dist/umd/652.avplayer.js +0 -1
- package/dist/umd/724.avplayer.js +0 -1
- package/dist/umd/726.avplayer.js +0 -1
- package/dist/umd/728.avplayer.js +0 -1
- package/dist/umd/765.avplayer.js +0 -1
- package/dist/umd/779.avplayer.js +0 -1
- package/dist/umd/888.avplayer.js +0 -1
- package/dist/umd/931.avplayer.js +0 -1
- package/dist/umd/967.avplayer.js +0 -1
package/dist/esm/967.avplayer.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const __webpack_esm_id__=967;export const __webpack_esm_ids__=[967];export const __webpack_esm_modules__={915:(t,i,e)=>{e.d(i,{FJ:()=>s,U5:()=>r});const s={10:86018,2:86017,11:86051,1:69645,4:86049,5:86049,6:86049,7:65543,8:65542},r={7:27,12:173,9:12,2:4,3:86,4:92,5:106,6:131}},1639:(t,i,e)=>{e.d(i,{A:()=>n});var s=e(82563),r=e(10700);class n{constructor(t=1048576,i=!0,e){if((0,s.A)(this,"data",void 0),(0,s.A)(this,"buffer",void 0),(0,s.A)(this,"pointer",void 0),(0,s.A)(this,"pos",void 0),(0,s.A)(this,"size",void 0),(0,s.A)(this,"littleEndian",void 0),(0,s.A)(this,"error",void 0),(0,s.A)(this,"onFlush",void 0),(0,s.A)(this,"onSeek",void 0),this.pointer=0,this.pos=BigInt(0),this.size=t,this.littleEndian=!i,this.error=0,e&&e.view)this.size=e.length,this.buffer=e,this.data=e.view;else if(e&&!e.byteOffset)this.size=e.length,this.buffer=e,this.data=new DataView(this.buffer.buffer);else{if(e)throw new Error("not support subarray of ArrayBuffer");this.buffer=new Uint8Array(this.size),this.data=new DataView(this.buffer.buffer)}}writeUint8(t){this.remainingLength()<1&&this.flush(),this.data.setUint8(this.pointer,t),this.pointer++,this.pos++}writeUint16(t){this.remainingLength()<2&&this.flush(),this.data.setUint16(this.pointer,t,this.littleEndian),this.pointer+=2,this.pos+=BigInt(2)}writeUint24(t){this.remainingLength()<3&&this.flush();const i=(16711680&t)>>16,e=(65280&t)>>8,s=255&t;this.littleEndian?(this.writeUint8(s),this.writeUint8(e),this.writeUint8(i)):(this.writeUint8(i),this.writeUint8(e),this.writeUint8(s))}writeUint32(t){this.remainingLength()<4&&this.flush(),this.data.setUint32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}writeUint64(t){this.remainingLength()<8&&this.flush(),this.data.setBigUint64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}writeInt8(t){this.remainingLength()<1&&this.flush(),this.data.setInt8(this.pointer,t),this.pointer++,this.pos++}writeInt16(t){this.remainingLength()<2&&this.flush(),this.data.setInt16(this.pointer,t,this.littleEndian),this.pointer+=2,this.pos+=BigInt(2)}writeInt24(t){this.writeUint24(t<0?t+16777216:t)}writeInt32(t){this.remainingLength()<4&&this.flush(),this.data.setInt32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}writeInt64(t){this.remainingLength()<8&&this.flush(),this.data.setBigInt64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}writeFloat(t){this.remainingLength()<4&&this.flush(),this.data.setFloat32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}writeDouble(t){this.remainingLength()<8&&this.flush(),this.data.setFloat64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}getPointer(){return this.pointer}getPos(){return this.pos}remainingLength(){return this.size-this.pointer}writeBuffer(t){if(!t.length)return;let i=t.length;if(this.remainingLength()<i){let e=0;for(;i>0;){this.flush();const s=Math.min(this.size,i);this.buffer.set(t.subarray(e,e+s),this.pointer),this.pointer+=s,this.pos+=BigInt(s),e+=s,i-=s}}else this.buffer.set(t,this.pointer),this.pointer+=i,this.pos+=BigInt(i)}writeString(t){const i=r.encode(t);return this.writeBuffer(i),i.length}flush(){if(!this.onFlush)throw this.error=-1048574,Error("IOWriter error, flush failed because of no flush callback");if(this.pointer){const t=this.onFlush(this.buffer.subarray(0,this.pointer));if(0!==t)throw this.error=t,Error("IOWriter error, flush failed")}this.pointer=0}flushToPos(t){if(!this.onFlush)throw this.error=-1048574,Error("IOWriter error, flush failed because of no flush callback");if(this.pointer){const i=this.onFlush(this.buffer.subarray(0,this.pointer),t);if(0!==i)throw this.error=i,Error("IOWriter error, flush failed")}this.pointer=0}seek(t){if(!this.onSeek)throw this.error=-1048574,Error("IOWriter error, seek failed because of no seek callback");this.flush();const i=this.onSeek(t);if(0!==i)throw this.error=i,Error("IOWriter error, seek failed");this.pos=t}seekInline(t){const i=this.pointer;this.pointer=Math.max(0,Math.min(this.size,t)),this.pos+=BigInt(this.pointer-i)}skip(t){const i=this.pointer;this.pointer=Math.min(this.size,this.pointer+t),this.pos+=BigInt(this.pointer-i)}back(t){const i=this.pointer;this.pointer=Math.max(0,this.pointer-t),this.pos+=BigInt(this.pointer-i)}getBuffer(){return this.buffer.subarray(0,this.pointer)}setEndian(t){this.littleEndian=!t}reset(){this.pointer=0,this.pos=BigInt(0),this.error=0}getBufferSize(){return this.size}}},3944:(t,i,e)=>{e.d(i,{A:()=>n});var s=e(82563),r=e(10700);class n{constructor(t=1048576,i=!0,e){if((0,s.A)(this,"data",void 0),(0,s.A)(this,"buffer",void 0),(0,s.A)(this,"pointer",void 0),(0,s.A)(this,"pos",void 0),(0,s.A)(this,"size",void 0),(0,s.A)(this,"littleEndian",void 0),(0,s.A)(this,"error",void 0),(0,s.A)(this,"onFlush",void 0),(0,s.A)(this,"onSeek",void 0),this.pointer=0,this.pos=BigInt(0),this.size=t,this.littleEndian=!i,this.error=0,e&&e.view)this.size=e.length,this.buffer=e,this.data=e.view;else if(e&&!e.byteOffset)this.size=e.length,this.buffer=e,this.data=new DataView(this.buffer.buffer);else{if(e)throw new Error("not support subarray of ArrayBuffer");this.buffer=new Uint8Array(this.size),this.data=new DataView(this.buffer.buffer)}}async writeUint8(t){this.remainingLength()<1&&await this.flush(),this.data.setUint8(this.pointer,t),this.pointer++,this.pos++}async writeUint16(t){this.remainingLength()<2&&await this.flush(),this.data.setUint16(this.pointer,t,this.littleEndian),this.pointer+=2,this.pos+=BigInt(2)}async writeUint24(t){this.remainingLength()<3&&await this.flush();const i=(16711680&t)>>16,e=(65280&t)>>8,s=255&t;this.littleEndian?(await this.writeUint8(s),await this.writeUint8(e),await this.writeUint8(i)):(await this.writeUint8(i),await this.writeUint8(e),await this.writeUint8(s))}async writeUint32(t){this.remainingLength()<4&&await this.flush(),this.data.setUint32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}async writeUint64(t){this.remainingLength()<8&&await this.flush(),this.data.setBigUint64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}async writeInt8(t){this.remainingLength()<1&&await this.flush(),this.data.setInt8(this.pointer,t),this.pointer++,this.pos++}async writeInt16(t){this.remainingLength()<2&&await this.flush(),this.data.setInt16(this.pointer,t,this.littleEndian),this.pointer+=2,this.pos+=BigInt(2)}async writeInt24(t){await this.writeUint24(t<0?t+16777216:t)}async writeInt32(t){this.remainingLength()<4&&await this.flush(),this.data.setInt32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}async writeInt64(t){this.remainingLength()<8&&await this.flush(),this.data.setBigInt64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}async writeFloat(t){this.remainingLength()<4&&await this.flush(),this.data.setFloat32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}async writeDouble(t){this.remainingLength()<8&&await this.flush(),this.data.setFloat64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}getPointer(){return this.pointer}getPos(){return this.pos}remainingLength(){return this.size-this.pointer}async writeBuffer(t){if(!t.length)return;let i=t.length;if(this.remainingLength()<i){let e=0;for(;i>0;){await this.flush();const s=Math.min(this.size,i);this.buffer.set(t.subarray(e,e+s),this.pointer),this.pointer+=s,this.pos+=BigInt(s),e+=s,i-=s}}else this.buffer.set(t,this.pointer),this.pointer+=i,this.pos+=BigInt(i)}async writeString(t){const i=r.encode(t);return await this.writeBuffer(i),i.length}async flush(){if(!this.onFlush)throw this.error=-1048574,Error("IOWriter error, flush failed because of no flush callback");if(this.pointer){const t=await this.onFlush(this.buffer.subarray(0,this.pointer));if(0!==t)throw this.error=t,Error("IOWriter error, flush failed")}this.pointer=0}async flushToPos(t){if(!this.onFlush)throw this.error=-1048574,Error("IOWriter error, flush failed because of no flush callback");if(this.pointer){const i=await this.onFlush(this.buffer.subarray(0,this.pointer),t);if(0!==i)throw this.error=i,Error("IOWriter error, flush failed")}this.pointer=0}async seek(t){if(!this.onSeek)throw this.error=-1048574,Error("IOWriter error, seek failed because of no seek callback");await this.flush();const i=await this.onSeek(t);if(0!==i)throw this.error=i,Error("IOWriter error, seek failed");this.pos=t}seekInline(t){const i=this.pointer;this.pointer=Math.max(0,Math.min(this.size,t)),this.pos+=BigInt(this.pointer-i)}skip(t){const i=this.pointer;this.pointer=Math.min(this.size,this.pointer+t),this.pos+=BigInt(this.pointer-i)}back(t){const i=this.pointer;this.pointer=Math.max(0,this.pointer-t),this.pos+=BigInt(this.pointer-i)}getBuffer(){return this.buffer.subarray(0,this.pointer)}setEndian(t){this.littleEndian=!t}reset(){this.pointer=0,this.pos=BigInt(0),this.error=0}getBufferSize(){return this.size}}},4974:(t,i,e)=>{e.d(i,{Tl:()=>o,an:()=>a,s2:()=>h});var s=e(82563),r=e(63856),n=e.n(r);class a{constructor(){(0,s.A)(this,"list",[])}}async function h(t){return new(n())((i=>{t.list.push(i),1===t.list.length&&i()}))}function o(t){t.list.shift(),t.list.length&&t.list[0]()}},5463:(t,i,e)=>{t.exports=e(28789)},8836:(t,i,e)=>{var s=e(89624),r=e(81767),n=e(41725).start,a=RangeError,h=isFinite,o=Math.abs,f=Date.prototype,u=f.toISOString,l=s(f.getTime),d=s(f.getUTCDate),p=s(f.getUTCFullYear),c=s(f.getUTCHours),g=s(f.getUTCMilliseconds),w=s(f.getUTCMinutes),b=s(f.getUTCMonth),y=s(f.getUTCSeconds);t.exports=r((function(){return"0385-07-25T07:06:39.999Z"!==u.call(new Date(-50000000000001))}))||!r((function(){u.call(new Date(NaN))}))?function(){if(!h(l(this)))throw new a("Invalid time value");var t=this,i=p(t),e=g(t),s=i<0?"-":i>9999?"+":"";return s+n(o(i),s?6:4,0)+"-"+n(b(t)+1,2,0)+"-"+n(d(t),2,0)+"T"+n(c(t),2,0)+":"+n(w(t),2,0)+":"+n(y(t),2,0)+"."+n(e,3,0)+"Z"}:u},9538:(t,i,e)=>{t.exports=e(55564)},14908:(t,i,e)=>{e.r(i),e.d(i,{default:()=>k});var s=e(82563),r=e(50442),n=e.n(r),a=e(18811),h=e.n(a),o=e(44046),f=e(79872),u=e(32536),l=e(3944),d=e(1639),p=e(75138),c=e(54805),g=e(22227),w=e(55978),b=e(39710),y=e(38902),m=e(60346),v=e(79300);class k extends y.A{constructor(...t){super(...t),(0,s.A)(this,"info",void 0),(0,s.A)(this,"socket",void 0),(0,s.A)(this,"session",void 0),(0,s.A)(this,"ioReader",void 0),(0,s.A)(this,"ioWriter",void 0),(0,s.A)(this,"flvWriter",void 0),(0,s.A)(this,"flvHeader",void 0),(0,s.A)(this,"packetQueue",void 0),(0,s.A)(this,"flvHeaderWrote",void 0),(0,s.A)(this,"hasMetadata",void 0),(0,s.A)(this,"bufferReader",void 0)}writeFlvData(t){this.flvWriter.writeUint8(t.type),this.flvWriter.writeUint24(t.payload.length),this.flvWriter.writeUint24(t.timestamp),this.flvWriter.writeUint8(t.timestamp>>24),this.flvWriter.writeUint24(0),this.flvWriter.writeBuffer(t.payload),this.flvWriter.writeUint32(t.payload.length+11),this.flvWriter.flush()}async handleRtmpPacket(t){if(this.flvHeaderWrote)this.writeFlvData(t);else{if(this.packetQueue.push(t),8===t.type)this.flvHeader.hasAudio=!0;else if(9===t.type)this.flvHeader.hasVideo=!0;else if(18===t.type&&(this.bufferReader?this.bufferReader.resetBuffer(t.payload):this.bufferReader=new p.A(t.payload),"onMetaData"===await c.$x(this.bufferReader,BigInt(t.payload.length)))){this.hasMetadata=!0;const i=await c.$x(this.bufferReader,BigInt(t.payload.length));this.flvHeader.hasAudio=(0,f.A)(i.audiocodecid),this.flvHeader.hasVideo=(0,f.A)(i.videocodecid)}if(this.packetQueue.length>10||this.hasMetadata){var i;if(this.flvHeader.write(this.flvWriter),this.flvWriter.writeUint32(0),!this.hasMetadata&&this.session.getDuration()){const t=new b.A;t.onMetaData={duration:this.session.getDuration()},t.write(this.flvWriter)}n()(i=this.packetQueue).call(i,(t=>{this.writeFlvData(t)})),this.packetQueue.length=0,this.flvHeaderWrote=!0}}}async send(t){return this.socket?(await this.socket.send(t),0):-1048574}async open(t){this.info=t,this.status=1,3===t.subProtocol?(this.socket=new v.A(this.options),await this.socket.open({url:t.url,webtransportOptions:t.webtransportOptions})):(this.socket=new m.A(this.options),await this.socket.open({url:t.url})),this.ioReader=new u.A,this.ioReader.onFlush=async t=>this.socket.read(t),this.ioReader.onSeek=async t=>this.socket.seek(t),this.ioReader.onSize=async()=>this.socket.size(),this.ioWriter=new l.A,this.ioWriter.onFlush=async t=>this.socket.write(t),this.ioWriter.onSeek=async t=>this.socket.seek(t),this.flvWriter=new d.A,this.flvWriter.onFlush=t=>(this.readQueue.push(h()(t).call(t)),this.consume&&this.consume(),0),this.flvHeader=new w.A,this.packetQueue=[],this.flvHeaderWrote=!1,this.hasMetadata=!1,this.session=new g.A(this.ioReader,this.ioWriter,{isLive:this.options.isLive,isPull:!0}),this.session.onMediaPacket=async(t,i)=>this.handleRtmpPacket(t),this.session.onError=()=>{this.status=3,this.consume&&this.consume()},await this.session.handshake();const i=o.qg(this.info.uri),e=i.pathname.split("/");await this.session.connect(e[1],`rtmp://${i.host}${i.port?":"+i.port:""}/${e[1]}`);const s=h()(e).call(e,2);return this.session.play((s.length>1?s.join("/"):s[0])||""),0}async seek(t){return await this.session.seek(Number(t)),0}async size(){return BigInt(0)}async stop(){this.socket&&(await this.socket.stop(),this.socket=null),this.status=4}}},21061:(t,i,e)=>{var s=e(74371),r=e(42391),n=e(61726),a=RangeError;t.exports=function(t){var i=r(n(this)),e="",h=s(t);if(h<0||h===1/0)throw new a("Wrong number of repetitions");for(;h>0;(h>>>=1)&&(i+=i))1&h&&(e+=i);return e}},21727:()=>{},22227:(t,i,e)=>{e.d(i,{A:()=>A});var s=e(82563),r=e(23339),n=e.n(r),a=e(63856),h=e.n(a),o=e(50442),f=e.n(o),u=e(96279),l=e(60255),d=e(46984),p=e(54805),c=e(17283),g=e(21782),w=e(82915),b=e(79579),y=e(13135),m=e(75138),v=e(4742),k=e(80030),U=e(4974);const I="packages/avprotocol/src/rtmp/RtmpSession.ts";class A{constructor(t,i,e){(0,s.A)(this,"ioReader",void 0),(0,s.A)(this,"ioWriter",void 0),(0,s.A)(this,"prevReadPacket",void 0),(0,s.A)(this,"prevWritePacket",void 0),(0,s.A)(this,"inChunkSize",void 0),(0,s.A)(this,"outChunkSize",void 0),(0,s.A)(this,"seq",void 0),(0,s.A)(this,"bufferWriter",void 0),(0,s.A)(this,"bufferReader",void 0),(0,s.A)(this,"requestMap",void 0),(0,s.A)(this,"state",void 0),(0,s.A)(this,"maxSentUnacked",void 0),(0,s.A)(this,"receiveReportSize",void 0),(0,s.A)(this,"duration",void 0),(0,s.A)(this,"options",void 0),(0,s.A)(this,"streamIdMap",void 0),(0,s.A)(this,"sendAsync",void 0),(0,s.A)(this,"onMediaPacket",void 0),(0,s.A)(this,"onError",void 0),this.ioReader=t,this.ioWriter=i,this.options=e,this.prevReadPacket=new(n()),this.prevWritePacket=new(n()),this.requestMap=new(n()),this.streamIdMap=new(n()),this.inChunkSize=128,this.outChunkSize=128,this.seq=0,this.maxSentUnacked=25e5,this.receiveReportSize=1048576,this.sendAsync=new U.an,this.bufferWriter=new v.A(new Uint8Array(1)),this.bufferReader=new m.A(new Uint8Array(1)),this.state=0}async handshake(){const t=(0,b.A)();await this.ioWriter.writeUint8(3),await this.ioWriter.writeUint32(0),await this.ioWriter.writeUint32(0);const i=new Uint8Array(1528);(0,k.A)(i),await this.ioWriter.writeBuffer(i),await this.ioWriter.flush(),await this.ioReader.readUint8();const e=await this.ioReader.readUint32();await this.ioReader.skip(4);const s=await this.ioReader.readBuffer(1528);await this.ioWriter.writeUint32(e),await this.ioWriter.writeUint32((0,b.A)()-t),await this.ioWriter.writeBuffer(s),await this.ioWriter.flush(),await this.ioReader.skip(1536),this.readRtmpPacket()}async sendPacket(t){await U.s2(this.sendAsync),await(0,d.U)(this.ioWriter,this.outChunkSize,t,this.prevWritePacket.get(t.channelId)),this.prevWritePacket.set(t.channelId,t),U.Tl(this.sendAsync)}async readPacket(){const t=await(0,d.w)(this.ioReader,this.inChunkSize,this.prevReadPacket);return this.prevReadPacket.set(t.channelId,t),t}handleChunkSize(t){t.payload.length>=4&&(this.bufferReader.resetBuffer(t.payload),this.inChunkSize=this.bufferReader.readUint32())}handleUserControl(t){t.payload.length>=2&&(this.bufferReader.resetBuffer(t.payload),6===this.bufferReader.readUint16()&&this.sendPong(t,this.bufferReader.readUint32()))}handleSetPeerBW(t){t.payload.length>=4&&(this.bufferReader.resetBuffer(t.payload),this.maxSentUnacked=this.bufferReader.readUint32(),w.Yz(`Max sent, unacked = ${this.maxSentUnacked}`,I,215))}handleWindowSizeACK(t){t.payload.length>=4&&(this.bufferReader.resetBuffer(t.payload),this.receiveReportSize=this.bufferReader.readUint32(),w.Yz(`Window acknowledgement size = ${this.receiveReportSize}`,I,222),this.receiveReportSize>>=1)}async handleInvoke(t){this.bufferReader.resetBuffer(t.payload);const i=BigInt(t.payload.length),e=await p.$x(this.bufferReader,i),s=await p.$x(this.bufferReader,i);if("_result"===e||"_error"===e){if(this.requestMap.has(s)){const t=await p.$x(this.bufferReader,i),r=await p.$x(this.bufferReader,i);"_result"===e?this.requestMap.get(s).resolve({options:t,info:r}):this.requestMap.get(s).reject({options:t,info:r}),this.requestMap.delete(s)}}else if("onStatus"===e){const t=await p.$x(this.bufferReader,i);let e=await p.$x(this.bufferReader,i);if("error"===e.level)w.z3(`Server error: ${e.description}, ${e.code}`,I,258),this.requestMap.has(s)?(this.requestMap.get(s).reject({options:t,info:e}),this.requestMap.delete(s)):this.onError&&this.onError();else{switch(e.code){case"NetStream.Play.Start":case"NetStream.Seek.Notify":this.state=3;break;case"NetStream.Play.Stop":case"NetStream.Play.UnpublishNotify":this.state=8;break;case"NetStream.Publish.Start":this.state=5}this.requestMap.has(s)&&(this.requestMap.get(s).resolve({options:t,info:e}),this.requestMap.delete(s))}}else"onBWDone"===e&&await this.sendCheckBW()}async handleNotify(t){this.bufferReader.resetBuffer(t.payload),"@setDataFrame"===await p.$x(this.bufferReader,BigInt(t.payload.length))&&(t.payload=t.payload.subarray(Number(this.bufferReader.getPos()))),t.payload.length&&this.onMediaPacket&&await this.onMediaPacket(t,this.streamIdMap.get(t.extra))}async readRtmpPacket(){for(;;)try{const t=await this.readPacket();switch(t.type){case 3:default:break;case 1:this.handleChunkSize(t);break;case 4:this.handleUserControl(t);break;case 6:this.handleSetPeerBW(t);break;case 5:this.handleWindowSizeACK(t);break;case 20:await this.handleInvoke(t);break;case 18:await this.handleNotify(t);break;case 22:case 8:case 9:this.onMediaPacket&&await this.onMediaPacket(t,this.streamIdMap.get(t.extra))}}catch(t){break}}async sendPong(t,i){if(t.payload.length<6)return void w.R8(`Too short ping packet (${t.payload.length})`,I,358);const e=new u.u(2,4,t.timestamp+1,6);this.bufferWriter.resetBuffer(e.payload),this.bufferWriter.writeUint16(7),this.bufferWriter.writeUint32(i),this.sendPacket(e)}async sendWindowAckSize(){const t=new u.u(2,5,0,4);this.bufferWriter.resetBuffer(t.payload),this.bufferWriter.writeUint32(this.maxSentUnacked),await this.sendPacket(t)}async sendBufferTime(t){const i=new u.u(2,4,1,10);this.bufferWriter.resetBuffer(i.payload),this.bufferWriter.writeUint16(3),this.bufferWriter.writeUint32(t),this.bufferWriter.writeUint32(this.options.clientBufferTime||3e3),await this.sendPacket(i)}async sendFCSubscribe(t){const i=new u.u(3,20,0,27+t.length);this.bufferWriter.resetBuffer(i.payload),p.bD(this.bufferWriter,"FCSubscribe"),p.bD(this.bufferWriter,++this.seq),p.bD(this.bufferWriter,null),p.bD(this.bufferWriter,t),await this.sendPacket(i)}async sendFCPublish(t){const i=new u.u(3,20,0,25+t.length);this.bufferWriter.resetBuffer(i.payload),p.bD(this.bufferWriter,"FCPublish"),p.bD(this.bufferWriter,++this.seq),p.bD(this.bufferWriter,null),p.bD(this.bufferWriter,t),await this.sendPacket(i)}async sendReleaseStream(t){const i=new u.u(3,20,0,29+t.length);this.bufferWriter.resetBuffer(i.payload),p.bD(this.bufferWriter,"releaseStream"),p.bD(this.bufferWriter,++this.seq),p.bD(this.bufferWriter,null),p.bD(this.bufferWriter,t),await this.sendPacket(i)}async sendCheckBW(){const t=new u.u(3,20,0,21);this.bufferWriter.resetBuffer(t.payload),p.bD(this.bufferWriter,"_checkbw"),p.bD(this.bufferWriter,++this.seq),p.bD(this.bufferWriter,null),await this.sendPacket(t)}async request(t,i){const e=new u.u(3,20,0,4096+l.iD);return this.bufferWriter.resetBuffer(e.payload),p.bD(this.bufferWriter,t),p.bD(this.bufferWriter,++this.seq),g.__(i,(t=>{p.bD(this.bufferWriter,t)})),e.payload=e.payload.subarray(0,this.bufferWriter.getPos()),new(h())(((t,i)=>{this.requestMap.set(this.seq,{resolve:t,reject:i}),this.sendPacket(e)}))}async connect(t,i){await this.request("connect",[{app:t,fourCcList:["hvc1","av01","vp09"],flashVer:"LNX 9,0,124,2",tcUrl:i,fpad:0,capabilities:15,audioCodecs:4071,videoCodecs:252,videoFunction:1}]),this.options.isPull&&await this.sendWindowAckSize()}async createStream(){return(await this.request("createStream",[null])).info}async play(t){const i=await this.createStream();if(this.streamIdMap.set(i,t),!this.options.isLive){const i=await h().race([this.request("getStreamLength",[null,t]),new y.A(1)]);c.ai(i)||(this.duration=i.info)}await this.sendFCSubscribe(t),this.request("play",[null,t,-1,-1,!0]),await this.sendBufferTime(i)}async publish(t){await this.sendReleaseStream(t),await this.sendFCPublish(t);const i=await this.createStream();this.streamIdMap.set(i,t),await this.request("publish",[null,t,"live"])}async sendStreamPacket(t,i){var e;let s=0;f()(e=this.streamIdMap).call(e,((t,e)=>{t===i&&(s=e)})),t.extra=s,await this.sendPacket(t)}async seek(t){const i=new u.u(3,20,0,26);this.bufferWriter.resetBuffer(i.payload),p.bD(this.bufferWriter,"seek"),p.bD(this.bufferWriter,0),p.bD(this.bufferWriter,null),p.bD(this.bufferWriter,t),await this.sendPacket(i)}async pause(t,i){const e=new u.u(3,20,0,29);this.bufferWriter.resetBuffer(e.payload),p.bD(this.bufferWriter,"pause"),p.bD(this.bufferWriter,0),p.bD(this.bufferWriter,null),p.bD(this.bufferWriter,t),p.bD(this.bufferWriter,i),await this.sendPacket(e)}getDuration(){return this.duration}}},26942:(t,i,e)=>{e(29643),e(41630);var s=e(72071),r=e(83105);s.JSON||(s.JSON={stringify:JSON.stringify}),t.exports=function(t,i,e){return r(s.JSON.stringify,null,arguments)}},28035:(t,i,e)=>{e(21727);var s=e(32354);t.exports=s},28789:(t,i,e)=>{var s=e(90216);t.exports=s},29074:(t,i,e)=>{var s=e(89838),r=e(89624),n=e(58352),a=r([].reverse),h=[1,2];s({target:"Array",proto:!0,forced:String(h)===String(h.reverse())},{reverse:function(){return n(this)&&(this.length=this.length),a(this)}})},29643:(t,i,e)=>{var s=e(89838),r=e(55701),n=e(76157),a=e(62113),h=e(8836),o=e(76280);s({target:"Date",proto:!0,forced:e(81767)((function(){return null!==new Date(NaN).toJSON()||1!==r(Date.prototype.toJSON,{toISOString:function(){return 1}})}))},{toJSON:function(t){var i=n(this),e=a(i,"number");return"number"!=typeof e||isFinite(e)?"toISOString"in i||"Date"!==o(i)?i.toISOString():r(h,i):null}})},32354:(t,i,e)=>{var s=e(55701),r=e(95497),n=e(53457),a=e(95397),h=e(79827),o=RegExp.prototype;t.exports=a.correct?function(t){return t.flags}:function(t){return a.correct||!n(o,t)||r(t,"flags")?t.flags:s(h,t)}},32536:(t,i,e)=>{e.d(i,{A:()=>u});var s=e(82563),r=e(63856),n=e.n(r),a=e(82915),h=e(10700),o=e(13135);const f="packages/common/src/io/IOReader.ts";class u{constructor(t=1048576,i=!0,e){if((0,s.A)(this,"data",void 0),(0,s.A)(this,"buffer",void 0),(0,s.A)(this,"pointer",void 0),(0,s.A)(this,"endPointer",void 0),(0,s.A)(this,"pos",void 0),(0,s.A)(this,"size",void 0),(0,s.A)(this,"littleEndian",void 0),(0,s.A)(this,"fileSize_",void 0),(0,s.A)(this,"error",void 0),(0,s.A)(this,"onFlush",void 0),(0,s.A)(this,"onSeek",void 0),(0,s.A)(this,"onSize",void 0),(0,s.A)(this,"flags",void 0),(0,s.A)(this,"flushResolve",void 0),this.pos=BigInt(0),this.pointer=0,this.error=0,this.endPointer=0,this.littleEndian=!i,this.flags=0,e&&e.view)this.size=e.length,this.buffer=e,this.data=e.view;else if(e&&!e.byteOffset)this.size=e.length,this.buffer=e,this.data=new DataView(this.buffer.buffer);else{if(e)throw new Error("not support subarray of ArrayBuffer");this.size=Math.max(t,102400),this.buffer=new Uint8Array(this.size),this.data=new DataView(this.buffer.buffer)}}async readUint8(){this.remainingLength()<1&&await this.flush(1);const t=this.data.getUint8(this.pointer);return this.pointer++,this.pos++,t}async peekUint8(){return this.remainingLength()<1&&await this.flush(1),this.data.getUint8(this.pointer)}async readUint16(){this.remainingLength()<2&&await this.flush(2);const t=this.data.getUint16(this.pointer,this.littleEndian);return this.pointer+=2,this.pos+=BigInt(2),t}async peekUint16(){return this.remainingLength()<2&&await this.flush(2),this.data.getUint16(this.pointer,this.littleEndian)}async readUint24(){this.remainingLength()<3&&await this.flush(3);const t=await this.readUint16(),i=await this.readUint8();return this.littleEndian?i<<16|t:t<<8|i}async peekUint24(){this.remainingLength()<3&&await this.flush(3);const t=this.pointer,i=this.pos,e=await this.readUint16(),s=await this.readUint8(),r=this.littleEndian?s<<16|e:e<<8|s;return this.pointer=t,this.pos=i,r}async readUint32(){this.remainingLength()<4&&await this.flush(4);const t=this.data.getUint32(this.pointer,this.littleEndian);return this.pointer+=4,this.pos+=BigInt(4),t}async peekUint32(){return this.remainingLength()<4&&await this.flush(4),this.data.getUint32(this.pointer,this.littleEndian)}async readUint64(){this.remainingLength()<8&&await this.flush(8);const t=this.data.getBigUint64(this.pointer,this.littleEndian);return this.pointer+=8,this.pos+=BigInt(8),t}async peekUint64(){return this.remainingLength()<8&&await this.flush(8),this.data.getBigUint64(this.pointer,this.littleEndian)}async readInt8(){this.remainingLength()<1&&await this.flush(1);const t=this.data.getInt8(this.pointer);return this.pointer++,this.pos++,t}async peekInt8(){return this.remainingLength()<1&&await this.flush(1),this.data.getInt8(this.pointer)}async readInt16(){this.remainingLength()<2&&await this.flush(2);const t=this.data.getInt16(this.pointer,this.littleEndian);return this.pointer+=2,this.pos+=BigInt(2),t}async peekInt16(){return this.remainingLength()<2&&await this.flush(2),this.data.getInt16(this.pointer,this.littleEndian)}async readInt24(){const t=await this.readUint24();return 8388608&t?t-16777216:t}async peekInt24(){const t=await this.peekUint24();return 8388608&t?t-16777216:t}async readInt32(){this.remainingLength()<4&&await this.flush(4);const t=this.data.getInt32(this.pointer,this.littleEndian);return this.pointer+=4,this.pos+=BigInt(4),t}async peekInt32(){return this.remainingLength()<4&&await this.flush(4),this.data.getInt32(this.pointer,this.littleEndian)}async readInt64(){this.remainingLength()<8&&await this.flush(8);const t=this.data.getBigInt64(this.pointer,this.littleEndian);return this.pointer+=8,this.pos+=BigInt(8),t}async peekInt64(){return this.remainingLength()<8&&await this.flush(8),this.data.getBigInt64(this.pointer,this.littleEndian)}async readFloat(){this.remainingLength()<4&&await this.flush(4);const t=this.data.getFloat32(this.pointer,this.littleEndian);return this.pointer+=4,this.pos+=BigInt(4),t}async peekFloat(){return this.remainingLength()<4&&await this.flush(4),this.data.getFloat32(this.pointer,this.littleEndian)}async readDouble(){this.remainingLength()<8&&await this.flush(8);const t=this.data.getFloat64(this.pointer,this.littleEndian);return this.pointer+=8,this.pos+=BigInt(8),t}async peekDouble(){return this.remainingLength()<8&&await this.flush(8),this.data.getFloat64(this.pointer,this.littleEndian)}async readHex(t=1){let i="";for(let e=0;e<t;e++){const t=(await this.readUint8()).toString(16);i+=1===t.length?"0"+t:t}return i}async peekHex(t=1){t>this.size&&(this.error=-1048574,a.h2("peekHex, length too large",f,416)),this.remainingLength()<t&&await this.flush(t);const i=this.pointer,e=this.pos;let s="";for(let i=0;i<t;i++){const t=(await this.readUint8()).toString(16);s+=1===t.length?"0"+t:t}return this.pointer=i,this.pos=e,s}async readBuffer(t,i){if(i||(i=new Uint8Array(t)),this.remainingLength()<t){let e=0;if(this.remainingLength()>0){const s=this.remainingLength();i.set(this.buffer.subarray(this.pointer,this.pointer+s),e),e+=s,this.pointer+=s,this.pos+=BigInt(s),t-=s}for(;t>0;){await this.flush();const s=Math.min(this.endPointer-this.pointer,t);i.set(this.buffer.subarray(this.pointer,this.pointer+s),e),e+=s,this.pointer+=s,this.pos+=BigInt(s),t-=s}}else i.set(this.buffer.subarray(this.pointer,this.pointer+t),0),this.pointer+=t,this.pos+=BigInt(t);return i}async peekBuffer(t,i){return t>this.size&&(this.error=-1048574,a.h2("peekBuffer, length too large",f,501)),this.remainingLength()<t&&await this.flush(t),i||(i=new Uint8Array(t)),i.set(this.buffer.subarray(this.pointer,this.pointer+t),0),i}async readToBuffer(t,i){if(this.remainingLength()<t){let e=0;if(this.remainingLength()>0){const s=this.remainingLength();i.set(this.buffer.subarray(this.pointer,this.pointer+s),e),e+=s,this.pointer+=s,this.pos+=BigInt(s),t-=s}for(;t>0;){try{await this.flush()}catch(t){if(-1048576===this.error&&e)return e;throw t}const s=Math.min(this.endPointer-this.pointer,t);i.set(this.buffer.subarray(this.pointer,this.pointer+s),e),e+=s,this.pointer+=s,this.pos+=BigInt(s),t-=s}return e}return i.set(this.buffer.subarray(this.pointer,this.pointer+t),0),this.pointer+=t,this.pos+=BigInt(t),t}async readString(t=1){const i=await this.readBuffer(t);return h.decode(i)}async peekString(t=1){const i=await this.peekBuffer(t);return h.decode(i)}async readLine(){let t="";for(;;){let i=!1;for(let e=this.pointer;e<this.endPointer;e++)if(10===this.buffer[e]||13===this.buffer[e]){e!==this.pointer&&(t+=await this.readString(e-this.pointer)),i=!0;break}if(i)break;t+=await this.readString(this.remainingLength()),await this.flush()}let i=await this.peekUint8();return 10!==i&&13!==i||(this.pointer++,13===i&&(i=await this.peekUint8(),10===i&&this.pointer++)),t}async peekLine(){if(this.remainingLength()<this.size)try{await this.flush()}catch(t){if(-1048576!==this.error)throw t}let t="",i=!1;for(let e=this.pointer;e<this.endPointer;e++)if(10===this.buffer[e]||13===this.buffer[e]){t+=await this.peekString(e-this.pointer),i=!0;break}return i||(this.error=-1048574,a.h2("peekLine, out of buffer",f,659)),t}getPointer(){return this.pointer}getPos(){return this.pos}async skip(t){const i=t;for(;this.remainingLength()<t;)t-=this.remainingLength(),this.pointer=this.endPointer,await this.flush();this.remainingLength()>=t&&(this.pointer+=t),this.pos+=BigInt(i)}remainingLength(){return this.endPointer-this.pointer}async flush_(t){return new(n())((async i=>{for(this.flushResolve=i;;){const e=await this.onFlush(t);if(-1048575!==e){this.flushResolve=null,i(e);break}await new o.A(0)}}))}async flush(t=0){if(this.onFlush||(this.error=-1048574,a.h2("IOReader error, flush failed because of no flush callback",f,738)),!(this.size-this.remainingLength()<=0)){if(t=Math.min(t,this.size),this.pointer<this.endPointer?(this.buffer.set(this.buffer.subarray(this.pointer,this.endPointer),0),this.endPointer=this.endPointer-this.pointer):this.endPointer=0,this.pointer=0,t)for(;this.remainingLength()<t;){const t=await this.flush_(this.buffer.subarray(this.endPointer));if(t<0)throw this.error=t,new Error(`IOReader error, flush ${-1048576===t?"ended":"failed"}, ret: ${t}`);this.endPointer+=t}else{const t=await this.flush_(this.buffer.subarray(this.endPointer));if(t<0)throw this.error=t,new Error(`IOReader error, flush ${-1048576===t?"ended":"failed"}, ret: ${t}`);this.endPointer+=t}this.error=0}}async seek(t,i=!1,e=!0){if(!i){const i=Number(t-this.pos);if(i<0&&Math.abs(i)<=this.pointer)return this.pointer+=i,void(this.pos=t);if(i>0&&this.pointer+i<this.endPointer)return this.pointer+=i,void(this.pos=t);if(0===i)return}this.onSeek||(this.error=-1048574,a.h2("IOReader error, seek failed because of no seek callback",f,809)),this.pointer=this.endPointer=0,this.pos=t;const s=await this.onSeek(t);0!==s&&(this.error=s,a.h2("IOReader error, seek failed",f,818)),e&&await this.flush()}getBuffer(){return this.buffer}appendBuffer(t){if(this.size-this.endPointer>=t.length)this.buffer.set(t,this.endPointer),this.endPointer+=t.length;else if(this.buffer.set(this.buffer.subarray(this.pointer,this.endPointer),0),this.endPointer=this.endPointer-this.pointer,this.pointer=0,this.size-this.endPointer>=t.length)this.buffer.set(t,this.endPointer),this.endPointer+=t.length;else{const i=Math.min(this.size-this.endPointer,t.length);this.buffer.set(t.subarray(0,i),this.endPointer),this.endPointer+=i,a.R8("IOReader, call appendBuffer but the buffer's size is lagger then the remaining size",f,856)}}reset(){this.pointer=this.endPointer=0,this.pos=BigInt(0),this.error=0}setEndian(t){this.littleEndian=!t}isBigEndian(){return!this.littleEndian}async fileSize(){if(this.fileSize_)return this.fileSize_;if(!this.onSize)return a.R8("IOReader error, fileSize failed because of no onSize callback",f,898),BigInt(0);try{this.fileSize_=await this.onSize()}catch(t){a.R8(`IOReader error, call fileSize failed: ${t}`,f,905),this.fileSize_=BigInt(0)}return this.fileSize_}getBufferSize(){return this.size}async pipe(t,i){if(i)if(this.remainingLength()<i){if(this.remainingLength()>0){const e=this.remainingLength();await t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+e)),this.pointer+=e,this.pos+=BigInt(e),i-=e}for(;i>0;){await this.flush();const e=Math.min(this.remainingLength(),i);await t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+e)),this.pointer+=e,this.pos+=BigInt(e),i-=e}}else await t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+i)),this.pointer+=i,this.pos+=BigInt(i);else{if(this.remainingLength()>0){const i=this.remainingLength();await t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+i)),this.pointer+=i,this.pos+=BigInt(i)}for(;await this.flush_(this.buffer.subarray(0))>0;){const i=this.remainingLength();await t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+i)),this.pointer+=i,this.pos+=BigInt(i)}}}abort(){this.error=-1048572,this.flushResolve&&(this.flushResolve(-1048572),this.flushResolve=null)}}},33236:(t,i,e)=>{e.d(i,{A:()=>n});var s=e(82915);const r="packages/avformat/src/function/mktag.ts";function n(t){4!==t.length&&s.R8(`tag length is not 4, tag: ${t}`,r,31);let i=0;for(let e=0;e<4;e++)i=i<<8|t.charCodeAt(e);return i}},35536:(t,i,e)=>{e.d(i,{Q:()=>u});var s,r,n=e(82563),a=e(23339),h=e.n(a),o=e(59650),f=e(73556);class u{constructor(t){(0,n.A)(this,"num",1),(0,n.A)(this,"den",1),t&&(this.den=t.den,this.num=t.num)}}s=u.prototype,(r=new(h())).set("num",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),r.set("den",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:4,8:0}),(0,f.A)(s,o.Og,!0),(0,f.A)(s,o.dc,4),(0,f.A)(s,o.g7,8),(0,f.A)(s,o.JY,r)},35651:(t,i,e)=>{var s=e(26942);t.exports=s},39710:(t,i,e)=>{e.d(i,{A:()=>d});var s=e(82563),r=e(18811),n=e.n(r),a=e(82816),h=e(54805),o=e(58650),f=e(82915),u=e(51670),l=e(1639);class d{constructor(){(0,s.A)(this,"onMetaData",void 0),this.onMetaData={canSeekToEnd:!1}}async read(t,i){const e=t.getPos(),s=e+BigInt(Math.floor(i)),r=await h.$x(t,s),n=await h.$x(t,s);this[r]=n,s>t.getPos()&&await t.skip(Number(BigInt.asIntN(32,s-t.getPos())));const a=Number(t.getPos()-e),u=await t.readUint32();return a+11!==u?(f.R8(`script size not match, size: ${a+11}, previousTagSize: ${u}`,"packages/avformat/src/formats/flv/FlvScriptTag.ts",60),o.LR):0}computeSize(){const t=[],i=new l.A;return i.onFlush=i=>(t.push(n()(i).call(i)),0),h.bD(i,"onMetaData"),h.bD(i,this.onMetaData),i.flush(),(0,u.A)(Uint8Array,t).length}write(t){if(this.onMetaData){const i=[],e=new l.A;e.onFlush=t=>(i.push(n()(t).call(t)),0),h.bD(e,"onMetaData"),h.bD(e,this.onMetaData),e.flush();const s=(0,u.A)(Uint8Array,i);a.M5(t,18,BigInt(0),void 0,s)}}dts2Position(t){if(this.canSeek()){let i=-1;const e=this.onMetaData.keyframes.times,s=this.onMetaData.keyframes.filepositions;let r;for(r=0;r<e.length;r++){if(e[r]===t){i=r;break}if(e[r]>t){i=Math.max(r-1,0);break}}return r&&r===e.length&&(i=e.length-1),{pos:s[i],dts:e[i]}}return{pos:-1,dts:-1}}position2DTS(t){if(this.canSeek()){let e=-1;const s=this.onMetaData.keyframes.times,r=this.onMetaData.keyframes.filepositions;let n=0;for(n=0;n<r.length;n++)if(r[n]>t){e=n;break}var i;return n===r.length?null!==(i=this.onMetaData.duration)&&void 0!==i?i:s[s.length-1]:s[e]}return-1}canSeek(){return!!(this.onMetaData.keyframes&&this.onMetaData.keyframes.filepositions&&this.onMetaData.keyframes.filepositions.length)}}},41725:(t,i,e)=>{var s=e(89624),r=e(36086),n=e(42391),a=e(21061),h=e(61726),o=s(a),f=s("".slice),u=Math.ceil,l=function(t){return function(i,e,s){var a,l,d=n(h(i)),p=r(e),c=d.length,g=void 0===s?" ":n(s);return p<=c||""===g?d:((l=o(g,u((a=p-c)/g.length))).length>a&&(l=f(l,0,a)),t?d+l:l+d)}};t.exports={start:l(!1),end:l(!0)}},44046:(t,i,e)=>{e.d(i,{ll:()=>b,qg:()=>f}),e(42399);var s=e(1193),r=e.n(s),n=(e(49497),e(5463)),a=e.n(n),h=e(22608),o=e.n(h);function f(t){const i=t,e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],s=/:\/\/([^\/@]*@?)\[(\S+)\]/;let r="";s.test(t)&&(t=t.replace(s,((t,i,e)=>(r=e,`://${i||""}a.b`))));const n={},a=/^(?:(?![^:@\/]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*)(?::([^:@\/]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(t);let h=14;for(;h--;){var o;n[e[h]]=null!==(o=a[h])&&void 0!==o?o:""}return r&&(n.host=r,n.source=i,n.authority=r+(n.port?":"+n.port:"")),{protocol:n.protocol,file:n.file,host:n.host,port:n.port,user:n.user,password:n.password,origin:`${n.protocol}://${n.authority}`,pathname:n.path,search:`?${n.query}`,hash:n.anchor?`#${n.anchor}`:""}}const u=/(?:\/|^)\.(?=\/)/g,l=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,d=/^(?=([^\/?#]*))\1([^]*)$/,p=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/;function c(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}function g(t){const i=p.exec(t);return i?{scheme:i[1]||"",netLoc:i[2]||"",path:i[3]||"",params:i[4]||"",query:i[5]||"",fragment:i[6]||""}:null}function w(t){var i,e;for(t=a()(i=t.split("")).call(i).join("").replace(u,"");t.length!==(t=t.replace(l,"")).length;);return a()(e=t.split("")).call(e).join("")}function b(t,i,e){if(e=e||{},t=r()(t).call(t),!(i=r()(i).call(i))){if(!e.alwaysNormalize)return t;let i=g(t);if(!i)throw new Error("Error trying to parse base URL.");return i.path=w(i.path),c(i)}let s=g(i);if(!s)throw new Error("Error trying to parse relative URL.");if(s.scheme)return e.alwaysNormalize?(s.path=w(s.path),c(s)):i;let n=g(t);if(!n)throw new Error("Error trying to parse base URL.");if(!n.netLoc&&n.path&&"/"!==n.path[0]){let t=d.exec(n.path);n.netLoc=t[1],n.path=t[2]}n.netLoc&&!n.path&&(n.path="/");const a={scheme:n.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};if(!s.netLoc&&(a.netLoc=n.netLoc,"/"!==s.path[0]))if(s.path){let t=n.path,i=t.substring(0,o()(t).call(t,"/")+1)+s.path;a.path=w(i)}else a.path=n.path,s.params||(a.params=n.params,s.query||(a.query=n.query));return null===a.path&&(a.path=e.alwaysNormalize?w(s.path):s.path),c(a)}},44241:(t,i,e)=>{var s=e(53457),r=e(28035),n=RegExp.prototype;t.exports=function(t){return t===n||s(n,t)?r(t):t.flags}},44292:(t,i,e)=>{e(29074);var s=e(42244);t.exports=s("Array","reverse")},46630:(t,i,e)=>{e.d(i,{Dh:()=>r,FQ:()=>l,H3:()=>o,KR:()=>f,N_:()=>n,SF:()=>a,f7:()=>g,go:()=>d,i0:()=>u,pu:()=>w,qs:()=>h,vh:()=>p,zg:()=>c});var s=e(35536);const r=-BigInt(1),n=-1,a=1e6,h=1e3,o=1e9,f=new s.Q({den:a,num:1}),u=new s.Q({den:h,num:1}),l=new s.Q({den:o,num:1}),d=(new s.Q({den:1,num:1}),2147483647),p=BigInt(0x8000000000000000),c=65535,g=4294967295,w=(BigInt(0x10000000000000000),8)},46984:(t,i,e)=>{e.d(i,{U:()=>o,w:()=>f});var s=e(96279),r=e(82915),n=e(51670);const a="packages/avprotocol/src/rtmp/util.ts";async function h(t,i,e){if(i<64)await t.writeUint8(i|e<<6);else if(i<320)await t.writeUint8(e<<6),await t.writeUint8(i-64);else{await t.writeUint8(1|e<<6);const s=i-64;await t.writeUint8(255&s),await t.writeUint8(s>>>8)}}async function o(t,i,e,s){const r=s&&s.extra===e.extra&&e.timestamp>=s.timestamp;let n=e.timestamp;r&&(n-=s.timestamp),e.tsField=n>16777215?16777215:n;let a=0;r&&(e.type===s.type&&e.payload.length===s.payload.length?(a=2,e.tsField===s.tsField&&(a=3)):a=1),await h(t,e.channelId,a),3!==a&&(await t.writeUint24(e.tsField),2!==a&&(await t.writeUint24(e.payload.length),await t.writeUint8(e.type),0===a&&(await t.writeUint8(e.extra),await t.writeUint8(e.extra>>8),await t.writeUint8(e.extra>>16),await t.writeUint8(e.extra>>24)))),16777215===e.tsField&&await t.writeUint32(n);let o=0;for(;o<e.payload.length;){const s=Math.min(i,e.payload.length-o);await t.writeBuffer(e.payload.subarray(o,o+s)),o+=s,o<e.payload.length&&(await h(t,e.channelId,3),16777215===e.tsField&&await t.writeUint32(n))}await t.flush()}async function f(t,i,e){const h=[],o=await t.readUint8();let f=63&o;f<2&&(f=0===await t.readUint8()?await t.readUint8()+64:64+(await t.readUint8()|await t.readUint8()<<8));const u=o>>>6,l=e.get(f);let d=l?l.payload.length:0,p=l?l.type:0,c=l?l.extra:0,g=0,w=0;if(3===u?g=l.tsField:(g=await t.readUint24(),2!==u&&(d=await t.readUint24(),p=await t.readUint8(),0===u&&(c=await t.readUint8(),c|=await t.readUint8()<<8,c|=await t.readUint8()<<16,c|=await t.readUint8()<<24))),w=16777215===g?await t.readUint32():g,0!==u&&(l?w+=l.timestamp:r.R8(`got invalid message fmt, channel id ${f} can not find prev message with fmt ${u}`,a,177)),d<i)h.push(await t.readBuffer(d));else{let e=d;for(;e;){const s=Math.min(i,e);if(h.push(await t.readBuffer(s)),e-=s,e){const i=63&await t.readUint8();i<2&&await t.skip(i+1),16777215===g&&await t.skip(4)}}}const b=new s.u(f,p,w,(0,n.A)(Uint8Array,h));return b.tsField=g,b.extra=c,b}},49497:(t,i,e)=>{t.exports=e(35651)},54163:(t,i,e)=>{e.d(i,{FP:()=>o,Mr:()=>h,iU:()=>l,j2:()=>u,k:()=>a,lb:()=>f});var s=e(53508),r=e(46630),n=e(61615);function a(t,i,e){return t*BigInt(i.num)*BigInt(e.den)/(BigInt(i.den)*BigInt(e.num))}function h(t,i,e){return t*BigInt(s.f[15](i))*BigInt(e.den)/(BigInt(s.f[15](i+4))*BigInt(e.num))}function o(t,i,e){return t*BigInt(i.num)*BigInt(s.f[15](e+4))/(BigInt(i.den)*BigInt(s.f[15](e)))}function f(t){return t.num/t.den}function u(t,i){if(isNaN(19))return{den:0,num:0};if(Math.abs(t)>r.go+3)return{den:0,num:t<0?-1:1};const e=t>1?{den:Math.floor(i/t+.5),num:i}:{den:i,num:Math.floor(t*i+.5)};return l(e),e}function l(t){const i=(0,n.A)(t.num,t.den);i<=1||(t.den/=i,t.num/=i)}},54805:(t,i,e)=>{e.d(i,{$x:()=>h,bD:()=>o});var s=e(17283),r=e(21782),n=e(34492);async function a(t,i){return{key:await t.readString(await t.readUint16()),value:await h(t,i)}}async function h(t,i){let e;switch(await t.readUint8()){case 0:e=await t.readDouble();break;case 1:e=!!await t.readUint8();break;case 2:e=await t.readString(await t.readUint16());break;case 3:for(e={};t.getPos()<i;){const{key:s,value:r}=await a(t,i);if(e[s]=r,9==(16777215&await t.peekUint24())){await t.skip(3);break}}break;case 8:for(e={},await t.skip(4);t.getPos()<i;){const{key:s,value:r}=await a(t,i);if(e[s]=r,9==(16777215&await t.peekUint24())){await t.skip(3);break}}break;case 9:case 5:e=null;break;case 10:e=[];const s=await t.readUint32();for(let r=0;r<s;r++)e.push(await h(t,i));break;case 11:const r=await t.readDouble(),n=await t.readInt16();e=new Date(r+60*n*1e3);break;case 12:e=await t.readString(await t.readUint32())}return e}function o(t,i){s.ai(i)?(t.writeUint8(0),t.writeDouble(i)):s.o(i)?(t.writeUint8(0),t.writeDouble(Number(i))):s.zM(i)?(t.writeUint8(1),t.writeUint8(i?1:0)):s.Yj(i)?i.length>=65536?(t.writeUint8(12),t.writeUint32(i.length),t.writeString(i)):(t.writeUint8(2),t.writeUint16(i.length),t.writeString(i)):s.YO(i)?(t.writeUint8(10),t.writeUint32(i.length),r.__(i,(i=>{o(t,i)}))):s.Ik(i)?(t.writeUint8(3),n.each(i,((i,e)=>{t.writeUint16(e.length),t.writeString(e),o(t,i)})),t.writeUint24(9)):i instanceof Date?(t.writeUint8(11),t.writeDouble(i.getTime()),t.writeInt16(0)):null==i&&t.writeUint8(5)}},55564:(t,i,e)=>{var s=e(44241);t.exports=s},55978:(t,i,e)=>{e.d(i,{A:()=>a});var s=e(82563),r=e(9538),n=e.n(r);class a{constructor(){(0,s.A)(this,"signature",void 0),(0,s.A)(this,"version",void 0),(0,s.A)(this,"flags",void 0),(0,s.A)(this,"dataOffset",void 0),(0,s.A)(this,"hasVideo",void 0),(0,s.A)(this,"hasAudio",void 0),this.signature="FLV",this.version=1,this.flags=0,this.dataOffset=9,this.hasAudio=!1,this.hasVideo=!1}async read(t){this.signature=await t.readString(3),this.version=await t.readUint8(),this.flags=await t.readUint8(),this.dataOffset=await t.readUint32(),this.hasAudio=!!(4&n()(this)),this.hasVideo=!!(1&n()(this))}write(t){this.flags=0,this.hasAudio&&(this.flags|=4),this.hasVideo&&(this.flags|=1),t.writeString(this.signature),t.writeUint8(this.version),t.writeUint8(n()(this)),t.writeUint32(this.dataOffset)}}},60255:(t,i,e)=>{e.d(i,{iD:()=>s});const s=1024},61615:(t,i,e)=>{function s(t,i){for(;0!==i;)[t,i]=[i,t%i];return t}e.d(i,{A:()=>s})},79827:(t,i,e)=>{var s=e(66415);t.exports=function(){var t=s(this),i="";return t.hasIndices&&(i+="d"),t.global&&(i+="g"),t.ignoreCase&&(i+="i"),t.multiline&&(i+="m"),t.dotAll&&(i+="s"),t.unicode&&(i+="u"),t.unicodeSets&&(i+="v"),t.sticky&&(i+="y"),i}},80030:(t,i,e)=>{let s;function r(t){s.getRandomValues(t)}e.d(i,{A:()=>r}),"undefined"!=typeof crypto&&(s=crypto)},82816:(t,i,e)=>{e.d(i,{M5:()=>n});var s=e(17283);function r(t,i,e){const s=t.getPos(),r=t.getPointer(),n=s-BigInt(Math.floor(r));i<s&&i>=n?(t.seekInline(r+Number(i-s)),t.writeUint24(e),t.seekInline(r)):(t.seek(i),t.writeUint24(e),t.seek(s))}function n(t,i,e,n,a,h){t.flush(),t.writeUint8(i);const o=t.getPos();t.writeUint24(0),t.writeUint24(Number(e&BigInt(16777215))),t.writeUint8(Number(e>>BigInt(24)&BigInt(255))),t.writeUint24(0);const f=t.getPos();n&&n(t),s.Pc(a)?(a(t),r(t,o,Number(t.getPos()-f))):a&&(r(t,o,a.length+Number(t.getPos()-f)),t.writeBuffer(a));const u=Number(t.getPos()-o)+1;h&&h(u),t.writeUint32(u)}},90216:(t,i,e)=>{var s=e(53457),r=e(44292),n=Array.prototype;t.exports=function(t){var i=t.reverse;return t===n||s(n,t)&&i===n.reverse?r:i}},95397:(t,i,e)=>{var s=e(58184),r=e(81767),n=s.RegExp,a=!r((function(){var t=!0;try{n(".","d")}catch(i){t=!1}var i={},e="",s=t?"dgimsy":"gimsy",r=function(t,s){Object.defineProperty(i,t,{get:function(){return e+=s,!0}})},a={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var h in t&&(a.hasIndices="d"),a)r(h,a[h]);return Object.getOwnPropertyDescriptor(n.prototype,"flags").get.call(i)!==s||e!==s}));t.exports={correct:a}},96279:(t,i,e)=>{e.d(i,{u:()=>r});var s=e(82563);class r{constructor(t,i,e,r){(0,s.A)(this,"channelId",void 0),(0,s.A)(this,"type",void 0),(0,s.A)(this,"timestamp",void 0),(0,s.A)(this,"tsField",0),(0,s.A)(this,"extra",0),(0,s.A)(this,"payload",void 0),this.channelId=t,this.type=i,this.timestamp=e,this.payload=r instanceof Uint8Array?r:new Uint8Array(r)}}},null:()=>{__webpack_require__(1193)}};
|
package/dist/umd/1.avplayer.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkAVPlayer=self.webpackChunkAVPlayer||[]).push([[1],{66192:(t,e,s)=>{s.d(e,{A:()=>h});var i=s(82563);class h{constructor(){(0,i.A)(this,"type",-1),(0,i.A)(this,"onStreamAdd",void 0)}async destroy(t){}}},80182:(t,e,s)=>{s.d(e,{A:()=>c});var i=s(82563),h=s(18811),r=s.n(h),a=s(21874),n=s.n(a),u=s(60783),o=s(51670);class c{constructor(){(0,i.A)(this,"buffer",void 0),(0,i.A)(this,"pos",void 0),(0,i.A)(this,"end",void 0),(0,i.A)(this,"ended",void 0),this.buffer=new Uint8Array(102400),this.pos=0,this.end=0,this.ended=!1}async read(t){if(this.ended&&this.pos>=this.end)return;const e=[];if(this.pos<this.end-4){let t=u.Ky(this.buffer.subarray(this.pos,this.end-4),3);if(t.offset>-1){var s;const e=r()(s=this.buffer).call(s,this.pos,this.pos+t.offset);return this.pos+=t.offset,e}var i,h;e.push(r()(i=this.buffer).call(i,this.pos,this.end-4)),n()(h=this.buffer).call(h,0,this.end-4,this.end),this.pos=0,this.end=4}for(;;){if(!this.ended&&this.end<this.buffer.length)try{const e=await t.readToBuffer(this.buffer.length-this.end,this.buffer.subarray(this.end));this.end+=e}catch(t){if(this.ended=!0,this.pos>=this.end)return e.length?(0,o.A)(Uint8Array,e):null}let s=u.Ky(this.buffer.subarray(this.pos,this.end-4),e.length?0:3);var a,c,d,l;if(s.offset>-1)return e.push(r()(a=this.buffer).call(a,this.pos,this.pos+s.offset)),this.pos+=s.offset,(0,o.A)(Uint8Array,e);if(this.ended)return e.push(r()(c=this.buffer).call(c,this.pos,this.end)),this.pos=this.end=0,(0,o.A)(Uint8Array,e);e.push(r()(d=this.buffer).call(d,this.pos,this.end-4)),n()(l=this.buffer).call(l,0,this.end-4,this.end),this.pos=0,this.end=4}}reset(){this.pos=0,this.end=0,this.ended=!1}}},93001:(t,e,s)=>{s.r(e),s.d(e,{default:()=>P});var i=s(82563),h=s(41450),r=s.n(h),a=s(50442),n=s.n(a),u=s(92793),o=s.n(u),c=s(53508),d=s(3029),l=s(66192),p=s(80182),f=s(26367),b=s(58650),g=s(83602),y=s(63624),A=s(46630),v=s(99723),_=s(25146),m=s(34492),q=s(51670),R=s(79627);const k={framerate:{num:30,den:1}};class P extends l.A{constructor(t={}){super(),(0,i.A)(this,"type",12),(0,i.A)(this,"options",void 0),(0,i.A)(this,"currentDts",void 0),(0,i.A)(this,"currentPts",void 0),(0,i.A)(this,"step",void 0),(0,i.A)(this,"slices",void 0),(0,i.A)(this,"naluPos",void 0),(0,i.A)(this,"queue",void 0),(0,i.A)(this,"bitReader",void 0),(0,i.A)(this,"sliceType",void 0),(0,i.A)(this,"naluType",void 0),(0,i.A)(this,"poc",void 0),(0,i.A)(this,"pocTid0",void 0),(0,i.A)(this,"sps",void 0),(0,i.A)(this,"naluReader",void 0),this.options=m.extend({},k,t)}init(t){t.ioReader&&t.ioReader.setEndian(!1),this.slices=[],this.queue=[],this.bitReader=new R.A(500),this.naluReader=new p.A}async destroy(t){if(this.queue.length){for(let t=0;t<this.queue.length;t++)(0,g.Qe)(this.queue[t].avpacket);this.queue.length=0}}isFrameNalu(t){return(t[1===t[2]?4:5]>>>3&31)<12}async readNaluFrame(t){let e=!1;const s=this.slices;for(this.slices=[],s.length&&(e=this.isFrameNalu(s[0]));;){const i=await this.naluReader.read(t.ioReader);if(!i)return s;const h=i[1===i[2]?4:5]>>>3&31;if(this.isFrameNalu(i))if(e){if(i[1===i[2]?5:6]>>>7)return this.slices.push(i),s;s.push(i)}else s.push(i),e=!0;else{if(e&&(20===h||19===h||15===h||14===h||16===h||12===h||13===h))return this.slices.push(i),s;s.push(i)}}}async readHeader(t){const e=t.createStream();for(e.codecpar.codecType=0,e.codecpar.codecId=196,e.timeBase.den=A.SF,e.timeBase.num=1,e.codecpar.flags|=1,this.currentDts=BigInt(0),this.currentPts=BigInt(0),this.naluPos=BigInt(0),this.poc=0,this.pocTid0=0,this.step=BigInt(Math.floor(A.SF/this.options.framerate.num*this.options.framerate.den));;){const s=await this.readNaluFrame(t);if(!s.length)return-1048576;const i=(0,q.A)(Uint8Array,s),h=v.sL(i);if(h){e.codecpar.extradata=(0,y.sY)(h.length),(0,f.lW)(e.codecpar.extradata,h.length,h),e.codecpar.extradataSize=h.length,v.XC(e,h);const a=r()(s).call(s,(t=>15==(t[1===t[2]?4:5]>>>3&31)));this.sps=v.wf(1===a[2]?a.subarray(3):a.subarray(4));const n=(0,g._5)(),u=(0,y.sY)(i.length);(0,f.lW)(u,i.length,i),(0,g.NX)(n,u,i.length),d.M[17](n+56,this.naluPos),this.naluPos+=BigInt(Math.floor(i.length)),d.M[17](n+16,this.currentDts),this.currentDts+=this.step,d.M[17](n+8,this.currentPts),this.currentPts+=this.step,d.M[15](n+32,e.index),d.M[15](n+36,1|c.f[15](n+36)),d.M[15](n+72,e.timeBase.num),d.M[15](n+76,e.timeBase.den),d.M[15](n+36,64|c.f[15](n+36)),t.interval.packetBuffer.push(n);break}this.naluPos+=BigInt(Math.floor(i.length))}return 0}computePoc(t,e,s,i){this.bitReader.reset(),this.bitReader.appendBuffer(s.subarray(0,500)),i&&this.bitReader.readU1();const h=this.bitReader.readU1(),r=this.bitReader.readU1();let a=0;h&&(a=this.bitReader.readU1()),this.bitReader.readU1()&&this.bitReader.readU1(),_.xb(this.bitReader);const n=this.bitReader.readU(this.sps.sps_log2_max_pic_order_cnt_lsb_minus4+4);a&&_.xb(this.bitReader);for(let t=0;t<8*this.sps.sps_num_extra_ph_bytes;t++)this.sps.sps_extra_ph_bit_present_flag[t]&&this.bitReader.readU1();let u=0,o=0;this.sps.sps_poc_msb_cycle_flag&&(o=this.bitReader.readU1(),o&&(u=this.bitReader.readU(this.sps.sps_poc_msb_cycle_len_minus1+1)));const c=1<<this.sps.sps_log2_max_pic_order_cnt_lsb_minus4+4;let d=0;if(8===t||7===t)d=o?u*c:0;else{const t=this.pocTid0,e=t&c-1,s=t-e;d=o?u*c:n<e&&e-n>=c/2?s+c:n>e&&n-e>c/2?s-c:s}this.poc=d+n,0!=e||r||2===t||3===t||(this.pocTid0=this.poc)}async readAVPacket_(t,e){const s=t.getStreamByMediaType(0),i=await this.readNaluFrame(t);if(!i.length)return-1048576;this.sliceType=-1;let h=!1,r=!0;n()(i).call(i,(t=>{const e=1===t[2]?t[4]:t[5],s=e>>>3&31,i=(7&e)-1;15===s&&(this.sps=v.wf(1===t[2]?t.subarray(3):t.subarray(4))),8!==s&&7!==s||(h=!0),19===s&&this.computePoc(s,i,t.subarray(1===t[2]?5:6),!1),s<14&&r&&(r=!1,this.naluType=s,t[1===t[2]?5:6]>>>7&&this.computePoc(s,i,t.subarray(1===t[2]?5:6),!0))}));const a=(0,q.A)(Uint8Array,i),u=(0,y.sY)(a.length);return(0,f.lW)(u,a.length,a),(0,g.NX)(e,u,a.length),d.M[17](e+56,this.naluPos),this.naluPos+=BigInt(Math.floor(a.length)),d.M[17](e+16,this.currentDts),this.currentDts+=this.step,d.M[15](e+32,s.index),d.M[15](e+72,s.timeBase.num),d.M[15](e+76,s.timeBase.den),d.M[15](e+36,64|c.f[15](e+36)),h&&d.M[15](e+36,1|c.f[15](e+36)),0}async readAVPacket(t,e){let s=this.queue.length;const i=()=>{var s,i;this.queue.length>1&&o()(s=this.queue).call(s,((t,e)=>t.poc-e.poc>0?1:-1));for(let t=0;t<this.queue.length;t++)d.M[17](this.queue[t].avpacket+8,this.currentPts),this.currentPts+=this.step;this.queue.length>1&&o()(i=this.queue).call(i,((t,e)=>c.f[17](t.avpacket+16)-c.f[17](e.avpacket+16)>BigInt(0)?1:-1)),this.queue.length&&((0,g.rN)(e,this.queue[0].avpacket),(0,g.Qe)(this.queue[0].avpacket));for(let e=1;e<this.queue.length;e++)t.interval.packetBuffer.push(this.queue[e].avpacket);this.queue.length=0};for(;;){const e=(0,g._5)();let h=await this.readAVPacket_(t,e);if(h<0)return(0,g.Qe)(e),this.queue.length?(i(),0):h;if(1&c.f[15](e+36)||9===this.naluType||1===this.sliceType||2===this.sliceType){if(1===s||(9===this.naluType||1&c.f[15](e+36))&&this.queue.length)return i(),this.queue.push({avpacket:e,poc:this.poc}),0;this.queue.push({avpacket:e,poc:this.poc}),s++}else this.queue.push({avpacket:e,poc:this.poc})}}async seek(t,e,s,i){const h=t.ioReader.getPos();return 2&i?(await t.ioReader.seek(s),h):BigInt(b.E$)}getAnalyzeStreamsCount(){return 1}}}}]);
|
package/dist/umd/134.avplayer.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkAVPlayer=self.webpackChunkAVPlayer||[]).push([[134],{27877:(t,e,i)=>{i.d(e,{GM:()=>u,mS:()=>l,ol:()=>g});var s=i(82563),r=i(50442),a=i.n(r),n=i(1193),o=i.n(n),h=i(16434),d=i.n(h),c=i(31512);const m={album:"album",artist:"artist",description:"description",encoder:"encoder",title:"title",tracknumber:"track",date:"date",genre:"genre",comment:"comment",albumartist:"albumArtist",composer:"composer",performer:"performer",discnumber:"disc",organization:"vendor",copyright:"copyright",license:"license",isrc:"isrc",lyrics:"lyrics",language:"language",label:"vendor",script:"lyrics",encoded_by:"vendor"};function g(t,e){t&&a()(t).call(t,(t=>{const i=t.split("=");if(2===i.length){var s,r;const t=o()(s=i[0]).call(s).toLowerCase(),a=o()(r=i[1]).call(r);m[t]?e[m[t]]=a:e[t.toLowerCase()]=a}}))}class l{constructor(t="vorbis"){(0,s.A)(this,"streamIndex",void 0),(0,s.A)(this,"packetType",void 0),(0,s.A)(this,"signature",void 0),(0,s.A)(this,"version",void 0),(0,s.A)(this,"channels",void 0),(0,s.A)(this,"sampleRate",void 0),(0,s.A)(this,"bitrateMaximum",void 0),(0,s.A)(this,"bitrateNominal",void 0),(0,s.A)(this,"bitrateMinimum",void 0),(0,s.A)(this,"blocksize0",void 0),(0,s.A)(this,"blocksize1",void 0),(0,s.A)(this,"framingFlag",void 0),this.signature=t,this.version=0,this.channels=1,this.sampleRate=48e3,this.bitrateMaximum=0,this.bitrateNominal=0,this.bitrateMinimum=0,this.blocksize0=2048,this.blocksize1=256}read(t){this.packetType=t.readUint8(),this.signature=t.readString(6),this.version=t.readUint32(),this.channels=t.readUint8(),this.sampleRate=t.readInt32(),this.bitrateMaximum=t.readInt32(),this.bitrateNominal=t.readInt32(),this.bitrateMinimum=t.readInt32();const e=255&t.readUint8();this.blocksize0=Math.pow(2,e>>>4),this.blocksize1=Math.pow(2,15&e),this.framingFlag=t.readUint8()}write(t){t.writeUint8(1),t.writeString(this.signature),t.writeUint32(this.version),t.writeUint8(this.channels),t.writeInt32(this.sampleRate),t.writeInt32(this.bitrateMaximum),t.writeInt32(this.bitrateNominal),t.writeInt32(this.bitrateMinimum),t.writeUint8(d()(this.blocksize0)<<4|d()(this.blocksize1)),t.writeUint8(1)}setCodec(t){this.sampleRate=t.sampleRate,this.channels=t.chLayout.nbChannels}}class u extends c.h{constructor(t="vorbis"){super(),(0,s.A)(this,"packetType",void 0),(0,s.A)(this,"framingFlag",void 0),this.signature=t,this.packetType=1,this.framingFlag=1}read(t){this.packetType=t.readUint8(),this.signature=t.readString(6),super.read(t),"vorbis"===this.signature&&(this.framingFlag=t.readUint8())}write(t){t.writeUint8(this.packetType),t.writeString(this.signature),super.write(t),"vorbis"===this.signature&&t.writeUint8(this.framingFlag)}addComment(t){this.comments.addComment(t)}setCodec(t){}}},29578:(t,e,i)=>{i.d(e,{A:()=>l});var s=i(9538),r=i.n(s),a=i(53508),n=i(98604),o=i(58650),h=i(83602),d=i(54163),c=i(46630),m=i(82915);const g="packages/avformat/src/function/seekInBytes.ts";async function l(t,e,i,s,l,u){const p=t.ioReader.getPos(),w=await t.ioReader.fileSize();let b=c.Dh,v=i;e.startTime!==c.Dh?v-=e.startTime:v-=e.firstDTS;const f=(0,d.k)(i,e.timeBase,c.i0);if(f<BigInt(1e4))return m.Yz(`seek pts is earlier then 10s, seek to first packet pos(${s}) directly`,g,78),await t.ioReader.seek(s),p;let k=(0,n.d)(t.streams,v,e.timeBase);const S=w-(0,n.d)(t.streams,BigInt(1e4),c.i0),U=(0,n.d)(t.streams,BigInt(1e4),c.i0);if(k>S&&(k=S),k<s)return await t.ioReader.seek(s),p;const A=(0,h._5)();let y=w,I=BigInt(0);t:for(;y-I<U&&(k=I),await t.ioReader.seek(k),await u(t),!(8&r()(t.ioReader));){let i=await l(t,A),s=a.f[17](A+56);if(!(i>=0)){b=c.Dh;break}{const r=(0,d.Mr)(a.f[17](A+8),A+72,c.i0);let n=r-f;if(m.Yz(`try to seek to pos: ${k}, got packet pts: ${a.f[17](A+8)}(${r}ms), diff: ${n}ms`,g,115),n<=BigInt(0)&&-n<BigInt(1e4)||y-I<U){const r=[s];for(;n<=0;){if(a.f[15](A+32)===e.index&&1&a.f[15](A+36)&&r.push(s),(0,h.Up)(A),i=await l(t,A),i<0){if(-1048576===i)break;if(-1048575===i)continue;b=c.Dh;break t}s=a.f[17](A+56),n=(0,d.Mr)(a.f[17](A+8),A+72,c.i0)-f}b=r.pop();break}n>BigInt(0)?(y=k,k=I+y>>BigInt(1)):(I=k,k=I+y>>BigInt(1))}if(8&r()(t.ioReader))break}return(0,h.Qe)(A),b!==c.Dh?(m.Yz(`finally seek to pos ${b}`,g,170),await t.ioReader.seek(b),await u(t),p):(await t.ioReader.seek(p),8&r()(t.ioReader)?BigInt(o.LT):BigInt(o.E$))}},31512:(t,e,i)=>{i.d(e,{B:()=>d,h:()=>c});var s=i(82563),r=i(3579),a=i.n(r),n=i(46630),o=i(10700);class h{constructor(){(0,s.A)(this,"list",void 0),this.list=[]}read(t,e){for(let i=0;i<e;i++){const e=t.readUint32();this.list.push(t.readString(e))}}write(t){for(let e=0;e<this.list.length;e++){const i=o.encode(this.list[e]);t.writeUint32(i.length),t.writeBuffer(i)}}addComment(t){this.list.push(t)}}class d{constructor(){(0,s.A)(this,"capturePattern",void 0),(0,s.A)(this,"streamStructureVersion",void 0),(0,s.A)(this,"headerTypeFlag",void 0),(0,s.A)(this,"granulePosition",void 0),(0,s.A)(this,"serialNumber",void 0),(0,s.A)(this,"pageSequenceNumber",void 0),(0,s.A)(this,"crcCheckSum",void 0),(0,s.A)(this,"numberPageSegments",void 0),(0,s.A)(this,"segmentTable",void 0),(0,s.A)(this,"payload",void 0),(0,s.A)(this,"pos",void 0),this.reset()}reset(){this.capturePattern="OggS",this.streamStructureVersion=0,this.headerTypeFlag=0,this.granulePosition=n.Dh,this.serialNumber=0,this.pageSequenceNumber=0,this.crcCheckSum=0,this.numberPageSegments=0,this.segmentTable=[],this.pos=BigInt(0)}async read(t){var e;this.pos=t.getPos(),await this.readPageHeader(t);const i=a()(e=this.segmentTable).call(e,((t,e)=>t+e),0);i&&(this.payload=await t.readBuffer(i))}async readPageHeader(t){if(this.capturePattern=await t.readString(4),this.streamStructureVersion=await t.readUint8(),this.headerTypeFlag=await t.readUint8(),this.granulePosition=await t.readUint64(),this.serialNumber=await t.readUint32(),this.pageSequenceNumber=await t.readUint32(),this.crcCheckSum=await t.readUint32(),this.numberPageSegments=await t.readUint8(),this.numberPageSegments)for(let e=0;e<this.numberPageSegments;e++){const e=await t.readUint8();this.segmentTable.push(e)}}write(t){if(this.pos=t.getPos(),t.writeString(this.capturePattern),t.writeUint8(this.streamStructureVersion),t.writeUint8(this.headerTypeFlag),t.writeUint64(this.granulePosition),t.writeUint32(this.serialNumber),t.writeUint32(this.pageSequenceNumber),t.writeUint32(this.crcCheckSum),this.payload){this.numberPageSegments=Math.floor(this.payload.length/255)+1;const e=this.payload.length%255;t.writeUint8(this.numberPageSegments);for(let e=0;e<this.numberPageSegments-1;e++)t.writeUint8(255);t.writeUint8(e),t.writeBuffer(this.payload)}else t.writeUint8(0)}}class c{constructor(){(0,s.A)(this,"streamIndex",void 0),(0,s.A)(this,"signature",void 0),(0,s.A)(this,"vendorStringLength",void 0),(0,s.A)(this,"vendorString",void 0),(0,s.A)(this,"userCommentListLength",void 0),(0,s.A)(this,"comments",void 0),this.vendorString="libmedia-v1.0.1-7-g938a591e",this.vendorStringLength=this.vendorString.length,this.userCommentListLength=0,this.comments=new h}read(t){this.vendorStringLength=t.readUint32(),this.vendorString=t.readString(this.vendorStringLength),this.userCommentListLength=t.readUint32(),this.userCommentListLength&&this.comments.read(t,this.userCommentListLength)}write(t){const e=o.encode(this.vendorString);t.writeUint32(e.length),t.writeBuffer(e),t.writeUint32(this.comments.list.length),this.comments.write(t)}addComment(t){this.comments.addComment(t)}setCodec(t){}}},98604:(t,e,i)=>{i.d(e,{d:()=>n});var s=i(21782),r=i(46630),a=i(54163);function n(t,e,i){let n=BigInt(0);return s.__(t,(t=>{n+=t.codecpar.bitrate*(0,a.k)(e,i,r.i0)/BigInt(8e3)})),n}}}]);
|
package/dist/umd/158.avplayer.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkAVPlayer=self.webpackChunkAVPlayer||[]).push([[158],{13158:(a,e,c)=>{c.d(e,{LV:()=>C,ML:()=>I,nF:()=>P,yr:()=>w});var t=c(18811),r=c.n(t),A=c(59650),s=c(53508),d=c(3029),i=c(27843),n=c(26367),o=c(82915),p=c(47037),M=c(63234),u=c(58650),f=c(63624),l=c(45912);const V="packages/avformat/src/formats/riff/iriff.ts";function D(a,e){let c=i.gi[a];return c?(65541===c?c=p.uU(e,!1,!1,-2):65557===c&&(c=p.uU(e,!0,!1,0)),69633===c&&8===e&&(c=69676),c):0}async function w(a,e,c){if(c<14)return o.z3("wav format size < 14",V,51),u.LR;d.M[15](e,1);const t=await a.readUint16();let r=await a.readUint16();const A=await a.readUint32();let i=8*await a.readUint32();const p=await a.readUint16();if(d.M[15](e+136,A),d.M[15](e+140,p),14===c?d.M[15](e+40,8):d.M[15](e+40,await a.readUint16()),65534===t?d.M[8](e+8,0):(d.M[8](e+8,t),d.M[15](e+4,D(t,s.f[15](e+40)))),c>=18&&357!==t){let r=await a.readUint16();c-=18,r=Math.min(c,r),r>=22&&65534===t&&(await a.skip(22),r-=22,c-=22),r>0&&(d.M[20](e+12,(0,f.sY)(r)),d.M[15](e+16,r),await a.readBuffer(r,(0,n.JW)(s.f[20](e+12),r)),c-=r),c>0&&await a.skip(c)}else if(357===t&&c>=32){c-=4,d.M[20](e+12,(0,f.sY)(c)),d.M[15](e+16,c),await a.readBuffer(c,(0,n.JW)(s.f[20](e+12),c));const t=l.E3(s.f[20](e+12)+4);if(d.M[15](e+136,l.Y0(s.f[20](e+12)+12)),r=0,i=0,c<8+20*t)return u.LR;for(let a=0;a<t;a++)r+=s.f[2](s.f[20](e+12)+(8+20*a+17))}return d.M[17](e+32,BigInt(i)),s.f[15](e+136)<0?(o.z3(`Invalid sample rate: ${s.f[15](e+136)}`,V,131),u.LR):(86065===s.f[15](e+4)&&(r=0,d.M[15](e+136,0)),69643==s.f[15](e+4)&&s.f[15](e+136)&&d.M[15](e+40,Number(BigInt.asIntN(32,s.f[17](e+32)))/s.f[15](e+136)),r!=s.f[15](e+116)&&(d.M[15](e+112,0),d.M[15](e+116,r)),0)}async function C(a,e,c){const t=a.getPos()+e;for(;a.getPos()<t;){const e=await a.readString(4),t=await a.readUint32(),r=await a.readString(t);c[e]=r,t%2&&await a.skip(1)}}async function P(a,e){const c=await a.readUint32();return e.codecpar.width=await a.readUint32(),e.codecpar.height=await a.readUint32(),await a.skip(2),e.codecpar.bitsPerCodedSample=await a.readUint16(),e.codecpar.codecTag=await a.readUint32(),await a.skip(20),c}async function I(a,e,c){if(c<14)return o.z3("wav header size < 14",V,199),u.LR;let t,d,p;if(M.bl(e.codecpar[A.o9]+112),t=await a.readUint16(),(357!==t||a.isBigEndian())&&(d=await a.readUint16(),e.codecpar.sampleRate=await a.readUint32(),p=8*await a.readUint32(),e.codecpar.blockAlign=await a.readUint16()),e.codecpar.bitsPerCodedSample=14===c?8:await a.readUint16(),65534===t?e.codecpar.codecTag=0:(e.codecpar.codecTag=t,e.codecpar.codecId=D(t,e.codecpar.bitsPerCodedSample)),c>=18&&357!=t){let s=await a.readUint16();if(a.isBigEndian())return o.z3("WAVEFORMATEX support for RIFX files",V,231),u.LR;c-=18,s=Math.min(s,c),s>=22&&65534==t&&(await async function(a,e){const c=await a.readUint16();c&&(e.codecpar.bitsPerCodedSample=c);const t=await a.readUint32();M.ML(e.codecpar[A.o9]+112,BigInt(t));const s=(await a.readHex(16)).toLocaleUpperCase();var d;r()(s).call(s,4)===i.IC||r()(s).call(s,4)===i.mO||r()(s).call(s,4)===i.dd?(e.codecpar.codecTag=await a.readUint32(),e.codecpar.codecId=D(e.codecpar.codecTag,e.codecpar.bitsPerCodedSample)):(e.codecpar.codecId=(d=s,i.t6[d.toLocaleUpperCase()]||0),e.codecpar.codecId||o.R8(`unknown subformat: ${s}`,V,192))}(a,e),s-=22,c-=22),s>0&&(e.codecpar.extradata&&(0,f.Eb)(e.codecpar.extradata),e.codecpar.extradataSize=s,e.codecpar.extradata=(0,f.sY)(s),await a.readBuffer(s,(0,n.JW)(e.codecpar.extradata,s)),c-=s),c>0&&await a.skip(c)}else if(357==t&&c>=32){c-=4,e.codecpar.extradata&&(0,f.Eb)(e.codecpar.extradata),e.codecpar.extradataSize=c,e.codecpar.extradata=(0,f.sY)(c),await a.readBuffer(c,(0,n.JW)(e.codecpar.extradata,c));const t=l.E3(e.codecpar.extradata+4);if(e.codecpar.sampleRate=l.Y0(e.codecpar.extradata+12),c<8+20*t)return u.LR;for(let a=0;a<t;a++)d+=s.f[2](e.codecpar.extradata+(8+20*a+17))}return e.codecpar.bitrate=BigInt(0|p),e.codecpar.sampleRate<0?(o.z3(`Invalid sample rate ${e.codecpar.sampleRate}`,V,274),u.LR):(86065===e.codecpar.codecId&&(d=0,e.codecpar.sampleRate=0),69643===e.codecpar.codecId&&e.codecpar.sampleRate&&(e.codecpar.bitsPerCodedSample=Number(e.codecpar.bitrate)/e.codecpar.sampleRate),d!==e.codecpar.chLayout.nbChannels&&(M.bl(e.codecpar[A.o9]+112),e.codecpar.chLayout.order=0,e.codecpar.chLayout.nbChannels=d),0)}},27843:(a,e,c)=>{c.d(e,{IC:()=>d,dd:()=>s,gi:()=>r,mO:()=>i,nz:()=>A,t6:()=>n});var t=c(51915);const r={1:65541,2:69638,3:65557,6:65543,7:65542,10:86052,16:69664,17:69633,23:69664,32:69646,34:86037,49:86046,50:86046,56:73728,66:86068,69:69643,20:69643,64:69643,80:86016,85:86017,87:73728,88:73729,97:69635,98:69634,100:69643,105:69633,117:86079,131:86069,255:86018,273:86068,304:86057,309:86106,352:86023,353:86024,354:86053,355:86054,357:86095,358:86096,384:86116,512:69644,533:86022,534:86022,624:86047,654:86111,655:69660,848:86114,1025:86043,1026:86074,1280:86081,1281:86081,5376:86046,5377:86037,5632:86018,5634:86065,8192:86019,8193:86020,8264:86085,8738:86069,27765:65542,28781:86018,16707:86018,16768:86116,22858:81922,29338:86069,33152:86116,41216:86068,41222:86018,41225:86051,61868:86028,65534:86112,21318:69645,22127:86021},A={[(0,t.A)("H261")]:3,[(0,t.A)("H263")]:4,[(0,t.A)("X263")]:4,[(0,t.A)("T263")]:4,[(0,t.A)("L263")]:4,[(0,t.A)("VX1K")]:4,[(0,t.A)("ZyGo")]:4,[(0,t.A)("M263")]:4,[(0,t.A)("lsvm")]:4,[(0,t.A)("I263")]:20,[(0,t.A)("U263")]:4,[(0,t.A)("VSM4")]:4,[(0,t.A)("H264")]:27,[(0,t.A)("h264")]:27,[(0,t.A)("X264")]:27,[(0,t.A)("x264")]:27,[(0,t.A)("avc1")]:27,[(0,t.A)("DAVC")]:27,[(0,t.A)("SMV2")]:27,[(0,t.A)("VSSH")]:27,[(0,t.A)("Q264")]:27,[(0,t.A)("V264")]:27,[(0,t.A)("GAVC")]:27,[(0,t.A)("UMSV")]:27,[(0,t.A)("tshd")]:27,[(0,t.A)("INMC")]:27,[(0,t.A)("FMP4")]:12,[(0,t.A)("DIVX")]:12,[(0,t.A)("DX50")]:12,[(0,t.A)("XVID")]:12,[(0,t.A)("MP4S")]:12,[(0,t.A)("M4S2")]:12,[(0,t.A)("DIVX")]:12,4:12,[(0,t.A)("ZMP4")]:12,[(0,t.A)("DIV1")]:12,[(0,t.A)("BLZ0")]:12,[(0,t.A)("mp4v")]:12,[(0,t.A)("UMP4")]:12,[(0,t.A)("WV1F")]:12,[(0,t.A)("SEDG")]:12,[(0,t.A)("RMP4")]:12,[(0,t.A)("3IV2")]:12,[(0,t.A)("WAWV")]:12,[(0,t.A)("FFDS")]:12,[(0,t.A)("FVFW")]:12,[(0,t.A)("DCOD")]:12,[(0,t.A)("MVXM")]:12,[(0,t.A)("PM4V")]:12,[(0,t.A)("SMP4")]:12,[(0,t.A)("DXGM")]:12,[(0,t.A)("VIDM")]:12,[(0,t.A)("M4T3")]:12,[(0,t.A)("GEOX")]:12,[(0,t.A)("G264")]:12,[(0,t.A)("HDX4")]:12,[(0,t.A)("DM4V")]:12,[(0,t.A)("DMK2")]:12,[(0,t.A)("DYM4")]:12,[(0,t.A)("DIGI")]:12,[(0,t.A)("EPHV")]:12,[(0,t.A)("EM4A")]:12,[(0,t.A)("M4CC")]:12,[(0,t.A)("SN40")]:12,[(0,t.A)("VSPX")]:12,[(0,t.A)("ULDX")]:12,[(0,t.A)("GEOV")]:12,[(0,t.A)("SIPP")]:12,[(0,t.A)("SM4V")]:12,[(0,t.A)("XVIX")]:12,[(0,t.A)("DreX")]:12,[(0,t.A)("QMP4")]:12,[(0,t.A)("PLV1")]:12,[(0,t.A)("GLV4")]:12,[(0,t.A)("GMP4")]:12,[(0,t.A)("MNM4")]:12,[(0,t.A)("GTM4")]:12,[(0,t.A)("MPG4")]:14,[(0,t.A)("MP41")]:14,[(0,t.A)("MP42")]:15,[(0,t.A)("DIV2")]:15,[(0,t.A)("MP43")]:16,[(0,t.A)("DIV3")]:16,[(0,t.A)("MPG3")]:16,[(0,t.A)("DIV5")]:16,[(0,t.A)("DIV6")]:16,[(0,t.A)("DIV4")]:16,[(0,t.A)("DVX3")]:16,[(0,t.A)("AP41")]:16,[(0,t.A)("COL1")]:16,[(0,t.A)("COL0")]:16,[(0,t.A)("WMV1")]:17,[(0,t.A)("WMV2")]:18,[(0,t.A)("GXVE")]:18,[(0,t.A)("dvsd")]:24,[(0,t.A)("dvhd")]:24,[(0,t.A)("dvh1")]:24,[(0,t.A)("dvsl")]:24,[(0,t.A)("dv25")]:24,[(0,t.A)("dv50")]:24,[(0,t.A)("cdvc")]:24,[(0,t.A)("CDVH")]:24,[(0,t.A)("CDV5")]:24,[(0,t.A)("dvc ")]:24,[(0,t.A)("dvcs")]:24,[(0,t.A)("dvh1")]:24,[(0,t.A)("dvis")]:24,[(0,t.A)("pdvc")]:24,[(0,t.A)("SL25")]:24,[(0,t.A)("SLDV")]:24,[(0,t.A)("AVd1")]:24,[(0,t.A)("mpg1")]:2,[(0,t.A)("mpg2")]:2,[(0,t.A)("MPEG")]:2,[(0,t.A)("PIM1")]:2,[(0,t.A)("PIM2")]:2,[(0,t.A)("VCR2")]:2,268435457:2,268435458:2,268435460:2,[(0,t.A)("DVR ")]:2,[(0,t.A)("MMES")]:2,[(0,t.A)("LMP2")]:2,[(0,t.A)("slif")]:2,[(0,t.A)("EM2V")]:2,[(0,t.A)("M701")]:2,[(0,t.A)("M702")]:2,[(0,t.A)("M703")]:2,[(0,t.A)("M704")]:2,[(0,t.A)("M705")]:2,[(0,t.A)("mpgv")]:2,[(0,t.A)("BW10")]:2,[(0,t.A)("XMPG")]:2,[(0,t.A)("MJPG")]:7,[(0,t.A)("RV40")]:69,[(0,t.A)("AV01")]:225,[(0,t.A)("VP80")]:139,[(0,t.A)("VP90")]:167,[(0,t.A)("HEVC")]:173,[(0,t.A)("H265")]:173},s="00001000800000AA00389B71",d="2107D3118644C8C1CA000000",i="0000000000001000800000AA",n={"2C806DE046DBCF11B4D100805F6CBBEA":86019,BFAA23E958CB7144A119FFFA01E4CE62:86055,D242E147BA368D4D88FC61654F8C836C:86104,AF87FBA7022DFB42A4D405CD93843BDD:86056,"2B806DE046DBCF11B4D100805F6CBBEA":86016,"82EC1F6ACADB1945BDE756D3B3EF981D":69673,"3AC1FA38811D4361A40DCE53CA607CD1":86112}},47037:(a,e,c)=>{function t(a,e,c,t){if(a<=0||a>64)return 0;if(e)switch(a){case 32:return c?65556:65557;case 64:return c?65558:65559;default:return 0}else if(a+=7,t&1<<(a>>>=3)-1)switch(a){case 1:return 65540;case 2:return c?65537:65536;case 3:return c?65549:65548;case 4:return c?65545:65544;case 8:return c?65568:65567;default:return 0}else switch(a){case 1:return 65541;case 2:return c?65539:65538;case 3:return c?65551:65550;case 4:return c?65547:65546;default:return 0}}function r(a){switch(a){case 69649:return 2;case 69648:return 3;case 69647:case 69633:case 69632:case 69645:case 69638:return 4;default:return function(a){switch(a){case 86070:case 86071:case 69674:case 69644:case 69678:case 69651:case 69661:case 69677:case 69655:case 69664:case 69636:case 69675:case 69660:case 69646:case 69670:return 4;case 86089:case 86090:case 86091:case 86092:case 65543:case 65542:case 65571:case 65540:case 65563:case 65572:case 65541:case 81924:case 81926:return 8;case 65537:case 65566:case 65536:case 65554:case 65539:case 65538:return 16;case 65552:case 65549:case 65548:case 65564:case 65551:case 65550:return 24;case 65545:case 65544:case 65565:case 65547:case 65546:case 65556:case 65557:case 65570:case 65569:return 32;case 65558:case 65559:case 65568:case 65567:return 64;default:return 0}}(a)}}c.d(e,{MZ:()=>r,uU:()=>t})},51915:(a,e,c)=>{c.d(e,{A:()=>A});var t=c(82915);const r="packages/avformat/src/function/mktagle.ts";function A(a){4!==a.length&&t.R8(`tag length is not 4, tag: ${a}`,r,30);let e=0;for(let c=3;c>=0;c--)e=e<<8|a.charCodeAt(c);return e}}}]);
|
package/dist/umd/236.avplayer.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunkAVPlayer=self.webpackChunkAVPlayer||[]).push([[236],{1340:(t,e,i)=>{"use strict";function a(t,e,i,a){const r=t.getPos(),s=t.getPointer(),n=r-BigInt(Math.floor(s));let o=!1;switch(e<r&&e>=n?(t.seekInline(s+Number(e-r)),o=!0):t.seek(e),a){case"uint8":t.writeUint8(255&i);break;case"int8":t.writeInt8(i);break;case"uint16":t.writeUint16(65535&i);break;case"int16":t.writeInt16(i);break;case"uint32":t.writeUint32(i>>>0);break;case"int32":t.writeInt32(i);break;case"uint64":t.writeUint64(BigInt.asUintN(64,i));break;case"int64":t.writeInt64(i);break;case"float":t.writeFloat(i);break;case"double":t.writeDouble(i)}o?t.seekInline(s):t.seek(r)}i.d(e,{A:()=>a})},1639:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var a=i(82563),r=i(10700);class s{constructor(t=1048576,e=!0,i){if((0,a.A)(this,"data",void 0),(0,a.A)(this,"buffer",void 0),(0,a.A)(this,"pointer",void 0),(0,a.A)(this,"pos",void 0),(0,a.A)(this,"size",void 0),(0,a.A)(this,"littleEndian",void 0),(0,a.A)(this,"error",void 0),(0,a.A)(this,"onFlush",void 0),(0,a.A)(this,"onSeek",void 0),this.pointer=0,this.pos=BigInt(0),this.size=t,this.littleEndian=!e,this.error=0,i&&i.view)this.size=i.length,this.buffer=i,this.data=i.view;else if(i&&!i.byteOffset)this.size=i.length,this.buffer=i,this.data=new DataView(this.buffer.buffer);else{if(i)throw new Error("not support subarray of ArrayBuffer");this.buffer=new Uint8Array(this.size),this.data=new DataView(this.buffer.buffer)}}writeUint8(t){this.remainingLength()<1&&this.flush(),this.data.setUint8(this.pointer,t),this.pointer++,this.pos++}writeUint16(t){this.remainingLength()<2&&this.flush(),this.data.setUint16(this.pointer,t,this.littleEndian),this.pointer+=2,this.pos+=BigInt(2)}writeUint24(t){this.remainingLength()<3&&this.flush();const e=(16711680&t)>>16,i=(65280&t)>>8,a=255&t;this.littleEndian?(this.writeUint8(a),this.writeUint8(i),this.writeUint8(e)):(this.writeUint8(e),this.writeUint8(i),this.writeUint8(a))}writeUint32(t){this.remainingLength()<4&&this.flush(),this.data.setUint32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}writeUint64(t){this.remainingLength()<8&&this.flush(),this.data.setBigUint64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}writeInt8(t){this.remainingLength()<1&&this.flush(),this.data.setInt8(this.pointer,t),this.pointer++,this.pos++}writeInt16(t){this.remainingLength()<2&&this.flush(),this.data.setInt16(this.pointer,t,this.littleEndian),this.pointer+=2,this.pos+=BigInt(2)}writeInt24(t){this.writeUint24(t<0?t+16777216:t)}writeInt32(t){this.remainingLength()<4&&this.flush(),this.data.setInt32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}writeInt64(t){this.remainingLength()<8&&this.flush(),this.data.setBigInt64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}writeFloat(t){this.remainingLength()<4&&this.flush(),this.data.setFloat32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}writeDouble(t){this.remainingLength()<8&&this.flush(),this.data.setFloat64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}getPointer(){return this.pointer}getPos(){return this.pos}remainingLength(){return this.size-this.pointer}writeBuffer(t){if(!t.length)return;let e=t.length;if(this.remainingLength()<e){let i=0;for(;e>0;){this.flush();const a=Math.min(this.size,e);this.buffer.set(t.subarray(i,i+a),this.pointer),this.pointer+=a,this.pos+=BigInt(a),i+=a,e-=a}}else this.buffer.set(t,this.pointer),this.pointer+=e,this.pos+=BigInt(e)}writeString(t){const e=r.encode(t);return this.writeBuffer(e),e.length}flush(){if(!this.onFlush)throw this.error=-1048574,Error("IOWriter error, flush failed because of no flush callback");if(this.pointer){const t=this.onFlush(this.buffer.subarray(0,this.pointer));if(0!==t)throw this.error=t,Error("IOWriter error, flush failed")}this.pointer=0}flushToPos(t){if(!this.onFlush)throw this.error=-1048574,Error("IOWriter error, flush failed because of no flush callback");if(this.pointer){const e=this.onFlush(this.buffer.subarray(0,this.pointer),t);if(0!==e)throw this.error=e,Error("IOWriter error, flush failed")}this.pointer=0}seek(t){if(!this.onSeek)throw this.error=-1048574,Error("IOWriter error, seek failed because of no seek callback");this.flush();const e=this.onSeek(t);if(0!==e)throw this.error=e,Error("IOWriter error, seek failed");this.pos=t}seekInline(t){const e=this.pointer;this.pointer=Math.max(0,Math.min(this.size,t)),this.pos+=BigInt(this.pointer-e)}skip(t){const e=this.pointer;this.pointer=Math.min(this.size,this.pointer+t),this.pos+=BigInt(this.pointer-e)}back(t){const e=this.pointer;this.pointer=Math.max(0,this.pointer-t),this.pos+=BigInt(this.pointer-e)}getBuffer(){return this.buffer.subarray(0,this.pointer)}setEndian(t){this.littleEndian=!t}reset(){this.pointer=0,this.pos=BigInt(0),this.error=0}getBufferSize(){return this.size}}},1965:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var a=i(92211),r=i(46630);function s(t,e,i){const s=i.duration,n=i.creationTime||0,o=i.modificationTime||0,c=i.timescale||0;let d=i.nextTrackId||1;i.fragment&&(d=2);let u=s<BigInt(r.f7)?0:1;u=n<r.f7?0:1,u=o<r.f7?0:1,t.writeUint32(1===u?120:108),t.writeString("mvhd"),t.writeUint8(u),t.writeUint24(0),1===u?(t.writeUint64(n),t.writeUint64(o)):(t.writeUint32(Number(n)),t.writeUint32(Number(o))),t.writeUint32(c),1===u?t.writeUint64(s):t.writeUint32(Number(s)),t.writeUint32(65536),t.writeUint16(256),t.writeUint16(0),t.writeUint32(0),t.writeUint32(0),(0,a.A)(t,1,0,0,1,0,0),t.writeUint32(0),t.writeUint32(0),t.writeUint32(0),t.writeUint32(0),t.writeUint32(0),t.writeUint32(0),t.writeUint32(d)}},11103:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var a=i(30115),r=i(26367);function s(t,e,i){t.writeUint8(e);for(let e=3;e>0;e--)t.writeUint8(i>>7*e|128);t.writeUint8(127&i)}function n(t,e,i){const n=e.privData,o=e.codecpar.extradata?5+e.codecpar.extradataSize:0,c=t.getPos();t.writeUint32(0),t.writeString("esds"),t.writeUint32(0),s(t,3,21+o+5+1),t.writeUint16(n.trackId),t.writeUint8(0),s(t,4,13+o),(86016===e.codecpar.codecId||86017===e.codecpar.codecId)&&e.codecpar.sampleRate>24e3?t.writeUint8(107):t.writeUint8(a.zs[e.codecpar.codecId]),94208===e.codecpar.codecId?t.writeUint8(225):1===e.codecpar.codecType?t.writeUint8(21):t.writeUint8(17),t.writeUint24(0),t.writeUint32(0),t.writeUint32(0),e.codecpar.extradata&&(s(t,5,e.codecpar.extradataSize),t.writeBuffer((0,r.s3)(e.codecpar.extradata,e.codecpar.extradataSize))),s(t,6,1),t.writeUint8(2),i.boxsPositionInfo.push({pos:c,type:"esds",size:Number(t.getPos()-c)})}},12660:(t,e,i)=>{"use strict";function a(t,e=0){if(!t)return!1;if(t.length<2)return!0;let i=t[e],a=e+1;for(;a<t.length&&i===t[a];a++);return a===t.length}i.d(e,{A:()=>a})},13361:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var a=i(41450),r=i.n(a),s=i(50442),n=i.n(s);function o(t,e,i){var a;const s=r()(a=i.currentFragment.tracks).call(a,(t=>t.trackId===e.privData.trackId)),o=t.getPos();var c;t.writeUint32(0),t.writeString("saiz"),t.writeUint32(0),t.writeUint8(s.cenc.sampleSizes.length?0:s.cenc.defaultSampleInfoSize),t.writeUint32(s.cenc.sampleCount),s.cenc.sampleSizes.length&&n()(c=s.cenc.sampleSizes).call(c,(e=>{t.writeUint8(e)})),i.boxsPositionInfo.push({pos:o,type:"saiz",size:Number(t.getPos()-o)})}},16694:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var a=i(26367),r=i(21464),s=i(60783);function n(t,e,i){let n;i.fragment&&e.sideData[1]?(n=e.sideData[1],delete e.sideData[1]):e.codecpar.extradata&&(n=(0,a.s3)(e.codecpar.extradata,e.codecpar.extradataSize)),n&&s.Bs(n)&&(n=r.S1(n)),t.writeUint32(8+(n?n.length:0)),t.writeString("hvcC"),n&&t.writeBuffer(n)}},18126:(t,e,i)=>{"use strict";i.d(e,{A:()=>m});var a=i(82563),r=i(53508),s=i(3029),n=i(28045),o=i(26367),c=i(82915),d=i(58650),u=i(83602),f=i(63624),l=i(24540),p=i(21464),h=i(99723);class m extends n.A{constructor(t=!1){super(),(0,a.A)(this,"cache",void 0),(0,a.A)(this,"cached",void 0),(0,a.A)(this,"reverseSps",void 0),this.reverseSps=t}init(t,e){return super.init(t,e),this.cache=(0,u._5)(),this.cached=!1,0}destroy(){super.destroy(),(0,u.Qe)(this.cache),this.cache=0}sendAVPacket(t){if(64&r.f[15](t+36)){let e;(0,u.zu)(this.cache,t);const i=(0,o.JW)(r.f[20](t+24),r.f[15](t+28));if(27===r.f[15](this.inCodecpar+4)?e=l.oT(i,this.reverseSps):173===r.f[15](this.inCodecpar+4)?e=p.oT(i,this.reverseSps):196===r.f[15](this.inCodecpar+4)?e=h.oT(i,this.reverseSps):c.h2(`not support for codecId: ${r.f[15](this.inCodecpar+4)}`,"packages/avformat/src/bsf/h2645/Annexb2AvccFilter.ts",114),s.M[15](this.cache+36,-65&r.f[15](this.cache+36)),(0,u.NX)(this.cache,e.bufferPointer,e.length),e.key&&s.M[15](this.cache+36,1|r.f[15](this.cache+36)),e.extradata){const t=(0,f.sY)(e.extradata.length);(0,o.lW)(t,e.extradata.length,e.extradata),(0,u.Ow)(this.cache,1,t,e.extradata.length)}}else(0,u.rN)(this.cache,t);return this.cached=!0,0}receiveAVPacket(t){return this.cached?((0,u.Up)(t),(0,u.rN)(t,this.cache),this.cached=!1,0):d.LR}reset(){return 0}}},19545:(t,e,i)=>{"use strict";i.d(e,{A:()=>r});var a=i(21782);function r(t,e){const i=t.getPos(),r=t.getPointer(),s=i-BigInt(Math.floor(r)),n=[];a.__(e.boxsPositionInfo,(e=>{e.pos<i&&e.pos>=s?(t.seekInline(r+Number(e.pos-i)),t.writeUint32(e.size)):n.push(e)})),t.seekInline(r),n.length&&(a.__(n,(e=>{t.seek(e.pos),t.writeUint32(e.size)})),t.seek(i)),e.boxsPositionInfo=[]}},19859:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var a=i(26367),r=i(24540),s=i(60783);function n(t,e,i){let n;i.fragment&&e.sideData[1]?(n=e.sideData[1],delete e.sideData[1]):e.codecpar.extradata&&(n=(0,a.s3)(e.codecpar.extradata,e.codecpar.extradataSize)),n&&s.Bs(n)&&(n=r.S1(n)),t.writeUint32(8+(n?n.length:0)),t.writeString("avcC"),n&&t.writeBuffer(n)}},20384:(t,e,i)=>{"use strict";i.d(e,{Ro:()=>I,dI:()=>U,l7:()=>v,yT:()=>P});var a=i(50442),r=i.n(a),s=i(41450),n=i.n(s),o=i(59650),c=i(53508),d=i(33236),u=i(74978),f=i(90600),l=i(37249),p=i(19545),h=i(21782),m=i(10700),g=i(26367),k=i(75472),w=i(83602);function v(t,e){t.flush();const i=t.getPointer(),a=t.getPos();t.writeUint32(0),t.writeUint32((0,d.A)("ftyp")),t.writeUint32(e.majorBrand||(0,d.A)("isom")),t.writeUint32(e.minorVersion||512),h.__(e.compatibleBrand,(e=>{t.writeUint32(e)})),function(t,e,i){const a=t.getPointer();t.seekInline(e),t.writeUint32(i),t.seekInline(a)}(t,i,Number(t.getPos()-a)),e.isom?(t.writeUint32(8),t.writeUint32((0,d.A)("wide"))):e.fragment||(t.writeUint32(8),t.writeUint32((0,d.A)("free")))}function b(t,e,i,a){h.__(e,(e=>{if(!e)return!0;if(f.A[e.type])f.A[e.type](t,i,a);else if(e.children){const r=t.getPos();t.writeUint32(0),t.writeUint32((0,d.A)(e.type)),b(t,e.children,i,a),a.boxsPositionInfo.push({pos:r,type:e.type,size:Number(t.getPos()-r)})}else!function(t,e){const i=h.zy(u._l,e);t.writeUint32(i?12:8),t.writeUint32((0,d.A)(e)),i&&t.writeUint32(0)}(t,e.type)}))}function U(t,e,i){var a;const s=t.getPos();t.writeUint32(0),t.writeUint32((0,d.A)("moov")),f.A.mvhd(t,null,i),h.__(e.streams,(e=>{if(1024&e.disposition||1!==e.codecpar.codecType&&0!==e.codecpar.codecType&&3!==e.codecpar.codecType)return!0;const a=t.getPos();t.writeUint32(0),t.writeUint32((0,d.A)("trak")),b(t,i.fragment?l.Jl[e.codecpar.codecType](i,e):l.BB[e.codecpar.codecType](i,e),e,i);const r=e.metadata.title;if(r){const e=m.encode(r);t.writeUint32(16+e.length),t.writeUint32((0,d.A)("udta")),t.writeUint32(8+e.length),t.writeUint32((0,d.A)("name")),t.writeBuffer(e)}i.boxsPositionInfo.push({pos:a,type:"trak",size:Number(t.getPos()-a)})}));let n=t.getPos();if(t.writeUint32(0),t.writeUint32((0,d.A)("udta")),f.A.meta(t,null,i),null!==(a=i.chapters)&&void 0!==a&&a.length&&f.A.chpl(t,null,i),i.boxsPositionInfo.push({pos:n,type:"udta",size:Number(t.getPos()-n)}),i.fragment){const a=t.getPos();t.writeUint32(0),t.writeUint32((0,d.A)("mvex")),h.__(e.streams,(e=>{if(1024&e.disposition||1!==e.codecpar.codecType&&0!==e.codecpar.codecType&&3!==e.codecpar.codecType)return!0;f.A.trex(t,e,i)})),i.boxsPositionInfo.push({pos:a,type:"mvex",size:Number(t.getPos()-a)}),i.ignoreEncryption||function(t,e,i){const a=[];h.__(e.streams,(t=>{const e=(0,w.Un)(t.codecpar[o.o9]+20,t.codecpar[o.o9]+24,24);if(e){const t=(0,k.ZK)((0,g.s3)(c.f[20](e),c.f[25](e+4)));r()(t).call(t,(t=>{(function(t){if(!a.length)return!1;for(let e=0;e<a.length;e++){const i=a[e];if(!h.FB(i.systemId,t.systemId))return!1;if(!i.keyIds||!t.keyIds)return!1;if(i.keyIds.length!==t.keyIds.length)return!1;for(let e=0;e<i.keyIds.length;e++)if(!h.FB(i.keyIds[e],t.keyIds[e]))return!1;if(!h.FB(i.data,t.data))return!1}return!0})(t)||a.push(t)}))}})),a.length&&r()(a).call(a,(e=>{var a;const s=t.getPos();t.writeUint32(0),t.writeUint32((0,d.A)("pssh")),t.writeUint8(1),t.writeUint24(0),t.writeBuffer(e.systemId),t.writeUint32(e.keyIds.length),r()(a=e.keyIds).call(a,(e=>{t.writeBuffer(e)})),t.writeUint32(e.data.length),t.writeBuffer(e.data),i.boxsPositionInfo.push({pos:s,type:"pssh",size:Number(t.getPos()-s)})}))}(t,e,i)}i.boxsPositionInfo.push({pos:s,type:"moov",size:Number(t.getPos()-s)}),(0,p.A)(t,i)}function I(t,e,i){const a=t.getPos();t.writeUint32(0),t.writeUint32((0,d.A)("moof")),f.A.mfhd(t,null,i),h.__(i.currentFragment.tracks,(a=>{var r;if(!a.sampleCount)return!0;const s=t.getPos();t.writeUint32(0),t.writeUint32((0,d.A)("traf"));const o=n()(r=e.streams).call(r,(t=>t.privData.trackId===a.trackId));b(t,(0,l.Ip)(a),o,i),i.boxsPositionInfo.push({pos:s,type:"traf",size:Number(t.getPos()-s)})}));const r=Number(t.getPos()-a);i.boxsPositionInfo.push({pos:a,type:"moof",size:r}),i.currentFragment.size=r}function P(t,e,i){let a=24;h.__(i.currentFragment.tracks,(t=>{var i;const r=n()(i=e.streams).call(i,(e=>e.index===t.streamIndex)).privData;r.fragIndexes.length&&(a+=24+19*r.fragIndexes.length)})),t.writeUint32(a),t.writeString("mfra"),h.__(i.currentFragment.tracks,(i=>{var a;const s=n()(a=e.streams).call(a,(t=>t.index===i.streamIndex)).privData;var o;s.fragIndexes.length&&(t.writeUint32(24+19*s.fragIndexes.length),t.writeString("tfra"),t.writeUint8(1),t.writeUint24(0),t.writeUint32(i.trackId),t.writeUint32(0),t.writeUint32(s.fragIndexes.length),r()(o=s.fragIndexes).call(o,(e=>{t.writeUint64(e.time),t.writeUint64(e.pos),t.writeUint8(1),t.writeUint8(1),t.writeUint8(1)})))})),t.writeUint32(16),t.writeString("mfro"),t.writeUint32(0),t.writeUint32(a)}},20638:(t,e,i)=>{t.exports=i(39712)},21991:(t,e,i)=>{"use strict";i.d(e,{A:()=>c});var a,r=i(82563),s=i(34492),n=i(82915);!function(t){t[t.ADD=0]="ADD",t[t.REMOVE=1]="REMOVE",t[t.UPDATE_TIMESTAMP_OFFSET=2]="UPDATE_TIMESTAMP_OFFSET",t[t.CALLBACK=3]="CALLBACK",t[t.CHANGE_MIME_TYPE=4]="CHANGE_MIME_TYPE"}(a||(a={}));const o={mediaBufferMax:10};class c{constructor(t={}){(0,r.A)(this,"sourceBuffer",void 0),(0,r.A)(this,"operatorQueue",void 0),(0,r.A)(this,"updating",void 0),(0,r.A)(this,"lastRemoveTime",void 0),(0,r.A)(this,"paddingCallback",void 0),(0,r.A)(this,"options",void 0),(0,r.A)(this,"ending",void 0),(0,r.A)(this,"onQuotaExceededError",void 0),(0,r.A)(this,"onEnded",void 0),this.options=s.extend({},o,t),this.operatorQueue=[],this.updating=!1,this.lastRemoveTime=0,this.ending=!1}setSourceBuffer(t){this.sourceBuffer&&(this.sourceBuffer.onupdateend=null,this.sourceBuffer.onerror=null),this.sourceBuffer=t,this.sourceBuffer.onupdateend=()=>{this.paddingCallback&&(this.paddingCallback(),this.paddingCallback=null),this.operatorQueue&&this.operatorQueue.length?this.enqueue():(this.updating=!1,this.ending&&this.onEnded&&this.onEnded())},this.sourceBuffer.onerror=t=>{n.z3(`track update buffer error: ${t}`,"packages/avrender/src/track/Track.ts",112)}}changeMimeType(t,e){this.sourceBuffer&&(this.operatorQueue.push({operator:a.CHANGE_MIME_TYPE,type:t,mode:e}),this.updating||this.enqueue())}enqueue(){if(this.operatorQueue.length){const t=this.operatorQueue.shift();if(t.operator===a.ADD)try{this.sourceBuffer.appendBuffer(t.buffer),this.updating=!0,t.callback&&(this.paddingCallback=t.callback)}catch(e){if(!(e instanceof DOMException&&"QuotaExceededError"===e.name))throw e;this.operatorQueue.unshift(t),this.onQuotaExceededError&&this.onQuotaExceededError(),this.updating=!1}else t.operator===a.REMOVE?(this.sourceBuffer.remove(t.start,t.end),this.updating=!0,t.callback&&(this.paddingCallback=t.callback)):t.operator===a.UPDATE_TIMESTAMP_OFFSET?(this.sourceBuffer.timestampOffset=t.timestampOffset,t.callback&&t.callback(),this.operatorQueue.length?this.enqueue():this.updating=!1):t.operator===a.CALLBACK?(t.callback&&t.callback(),this.operatorQueue.length?this.enqueue():this.updating=!1):t.operator===a.CHANGE_MIME_TYPE&&(this.sourceBuffer.changeType(t.type),this.sourceBuffer.mode=t.mode,this.sourceBuffer.timestampOffset=0)}}addBuffer(t,e){t?(this.operatorQueue.push({operator:a.ADD,buffer:t,callback:e}),this.updating||this.enqueue()):e&&e()}insertEnqueueCallback(t){this.operatorQueue.push({operator:a.CALLBACK,callback:t}),this.updating||this.enqueue()}updateTimestampOffset(t,e){this.operatorQueue.push({operator:a.UPDATE_TIMESTAMP_OFFSET,timestampOffset:t,callback:e}),this.updating||this.enqueue()}removeBuffer(t,e){this.ending||(t=Math.floor(t))-this.lastRemoveTime<this.options.mediaBufferMax<<1||(this.operatorQueue.push({operator:a.REMOVE,start:this.lastRemoveTime,end:t-this.options.mediaBufferMax,callback:e}),this.updating||this.enqueue(),this.lastRemoveTime=t-this.options.mediaBufferMax)}removeAllBuffer(t){this.sourceBuffer.buffered.length?(this.operatorQueue.push({operator:a.REMOVE,start:this.sourceBuffer.buffered.start(0),end:this.sourceBuffer.buffered.end(this.sourceBuffer.buffered.length-1),callback:t}),this.updating||this.enqueue()):t&&t()}end(){this.ending=!0,this.updating||this.operatorQueue.length||this.onEnded&&this.onEnded()}stop(){if(this.sourceBuffer){try{this.sourceBuffer.abort(),this.updating=!1}catch(t){}try{this.sourceBuffer.buffered.length&&(this.updating?this.operatorQueue.push({operator:a.REMOVE,start:this.sourceBuffer.buffered.start(0),end:this.sourceBuffer.buffered.end(this.sourceBuffer.buffered.length-1)}):(this.sourceBuffer.remove(this.sourceBuffer.buffered.start(0),this.sourceBuffer.buffered.end(this.sourceBuffer.buffered.length-1)),this.updating=!0)),this.paddingCallback&&(this.paddingCallback(),this.paddingCallback=null)}catch(t){}}}reset(){this.stop(),this.operatorQueue.length=0,this.ending=!1}isPaused(){return!this.updating&&this.operatorQueue.length}getQueueLength(){return this.operatorQueue.length}getBufferedTime(){return this.sourceBuffer&&this.sourceBuffer.buffered.length?this.sourceBuffer.buffered.end(this.sourceBuffer.buffered.length-1)-this.sourceBuffer.buffered.start(0):0}getBufferedStart(){return this.sourceBuffer&&this.sourceBuffer.buffered.length?this.sourceBuffer.buffered.start(0):0}getBufferedEnd(){return this.sourceBuffer&&this.sourceBuffer.buffered.length?this.sourceBuffer.buffered.end(this.sourceBuffer.buffered.length-1):0}getBufferedDuration(t){if(this.sourceBuffer&&this.sourceBuffer.buffered.length){let e=0;try{for(let i=0;i<this.sourceBuffer.buffered.length;i++){const a=Math.max(t,this.sourceBuffer.buffered.start(i));e+=Math.max(t,this.sourceBuffer.buffered.end(i))-a}}catch(t){}return e}return 0}getSourceBuffer(){return this.sourceBuffer}setMediaBufferMax(t){this.options.mediaBufferMax=t}getMediaBufferMax(){return this.options.mediaBufferMax}destroy(){this.stop(),this.operatorQueue=null,this.sourceBuffer&&(this.sourceBuffer.onupdateend=this.sourceBuffer.onerror=null,this.sourceBuffer=null)}}},22509:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var a=i(41450),r=i.n(a),s=i(9538),n=i.n(s);function o(t,e,i){var a,s,o,c,d,u;const f=r()(a=i.currentFragment.tracks).call(a,(t=>t.trackId===e.privData.trackId)),l=r()(s=i.trexs).call(s,(t=>{t.trackId,e.privData.trackId})),p=null!==(o=null==l?void 0:l.duration)&&void 0!==o?o:0,h=null!==(c=null==l?void 0:l.size)&&void 0!==c?c:0,m=null!==(d=null==(u=l)?void 0:n()(u))&&void 0!==d?d:0;t.writeUint32(32),t.writeString("trex"),t.writeUint8(0),t.writeUint24(0),t.writeUint32(f.trackId),t.writeUint32(1),t.writeUint32(p),t.writeUint32(h),t.writeUint32(m)}},25638:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var a=i(41450),r=i.n(a);function s(t,e,i){var a;const s=r()(a=i.currentFragment.tracks).call(a,(t=>t.trackId===e.privData.trackId));t.writeUint32(20),t.writeString("saio"),t.writeUint32(0),t.writeUint32(1),s.cenc.offsetPos=t.getPos(),t.writeUint32(0)}},28045:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var a=i(82563),r=i(53508),s=i(63624),n=i(19611);class o{constructor(){(0,a.A)(this,"inCodecpar",void 0),(0,a.A)(this,"inTimeBase",void 0),(0,a.A)(this,"outCodecpar",void 0)}init(t,e){return this.inCodecpar=(0,s.Gy)(168),(0,n.Yi)(this.inCodecpar,t),this.inTimeBase={den:r.f[15](e+4),num:r.f[15](e)},0}destroy(){this.inCodecpar&&((0,n.dn)(this.inCodecpar),this.inCodecpar=0)}}},30172:(t,e,i)=>{"use strict";function a(t,e,i){const a=t.getPos();t.writeUint32(0),t.writeString("hdlr"),t.writeUint8(0),t.writeUint24(0);let r="dhlr",s="url ",n="DataHandler";e&&(r="mhlr",1===e.codecpar.codecType?(s="soun",n="SoundHandler"):0===e.codecpar.codecType?(s="vide",n="VideoHandler"):3===e.codecpar.codecType?(s="text",n="SubtitleHandler"):(e.metadata.handlerName&&(n=e.metadata.handlerName),e.metadata.hdlrType&&(s=e.metadata.hdlrType))),t.writeString(r),t.writeString(s),t.writeUint32(0),t.writeUint32(0),t.writeUint32(0),e&&!i.isom||t.writeUint8(n.length),t.writeString(n),e&&!i.isom&&t.writeUint8(0),i.boxsPositionInfo.push({pos:a,type:"hdlr",size:Number(t.getPos()-a)})}i.d(e,{A:()=>a})},32094:(t,e,i)=>{"use strict";i.d(e,{A:()=>r});var a=i(46630);function r(t){return t.startPts!==a.Dh?t.lastPts-t.startPts:t.startDts===a.Dh?t.lastPts:t.lastPts-(t.startDts+BigInt(0|t.startCT))}},32125:(t,e,i)=>{"use strict";function a(t,e,i){t.writeUint32(16),t.writeString("mfhd"),t.writeUint8(0),t.writeUint24(0),t.writeUint32(i.currentFragment.sequence)}i.d(e,{A:()=>a})},33142:(t,e,i)=>{"use strict";function a(t,e,i){t.writeUint32(16),t.writeString("smhd"),t.writeUint32(0),t.writeUint16(0),t.writeUint16(0)}i.d(e,{A:()=>a})},37249:(t,e,i)=>{"use strict";i.d(e,{BB:()=>n,Ip:()=>o,Jl:()=>s});var a=i(9538),r=i.n(a);const s={1:function(t,e){return[{type:"tkhd"},{type:"mdia",children:[{type:"mdhd"},{type:"hdlr"},{type:"minf",children:[{type:"smhd"},t.isom?{type:"minf_hdlr"}:null,{type:"dinf",children:[{type:"dref",children:[{type:"url "}]}]},{type:"stbl",children:[{type:"stsd"},{type:"stts"},{type:"stsc"},{type:"stsz"},{type:"stco"}]}]}]}]},0:function(t,e){return[{type:"tkhd"},{type:"mdia",children:[{type:"mdhd"},{type:"hdlr"},{type:"minf",children:[{type:"vmhd"},t.isom?{type:"minf_hdlr"}:null,{type:"dinf",children:[{type:"dref",children:[{type:"url "}]}]},{type:"stbl",children:[{type:"stsd"},{type:"stts"},{type:"stsc"},{type:"stsz"},{type:"stco"}]}]}]}]},3:function(t,e){return[{type:"tkhd"},{type:"mdia",children:[{type:"mdhd"},{type:"hdlr"},{type:"minf",children:[{type:94232===e.codecpar.codecId?"sthd":"nmhd"},t.isom?{type:"minf_hdlr"}:null,{type:"dinf",children:[{type:"dref",children:[{type:"url "}]}]},{type:"stbl",children:[{type:"stsd"},{type:"stts"},{type:"stsc"},{type:"stsz"},{type:"stco"}]}]}]}]}},n={1:function(t,e){return[{type:"tkhd"},{type:"edts"},{type:"mdia",children:[{type:"mdhd"},{type:"hdlr"},{type:"minf",children:[{type:"smhd"},t.isom?{type:"minf_hdlr"}:null,{type:"dinf",children:[{type:"dref",children:[{type:"url "}]}]},{type:"stbl",children:[{type:"stsd"},{type:"stts"},{type:"stsc"},{type:"stsz"},{type:t.use64Mdat?"co64":"stco"}]}]}]}]},0:function(t,e){let i=!0;if(27===e.codecpar.codecId||173===e.codecpar.codecId||196===e.codecpar.codecId){const t=e.privData;2&r()(e.codecpar)&&(!t.cttsSampleCounts||!t.cttsSampleCounts.length||1===t.cttsSampleCounts.length&&0===t.cttsSampleOffsets[0])&&(i=!1)}return[{type:"tkhd"},{type:"edts"},{type:"mdia",children:[{type:"mdhd"},{type:"hdlr"},{type:"minf",children:[{type:"vmhd"},t.isom?{type:"minf_hdlr"}:null,{type:"dinf",children:[{type:"dref",children:[{type:"url "}]}]},{type:"stbl",children:[{type:"stsd"},{type:"stts"},{type:"stss"},i?{type:"ctts"}:null,{type:"stsc"},{type:"stsz"},{type:t.use64Mdat?"co64":"stco"}]}]}]}]},3:function(t,e){return[{type:"tkhd"},{type:"edts"},{type:"mdia",children:[{type:"mdhd"},{type:"hdlr"},{type:"minf",children:[{type:94232===e.codecpar.codecId?"sthd":"nmhd"},t.isom?{type:"minf_hdlr"}:null,{type:"dinf",children:[{type:"dref",children:[{type:"url "}]}]},{type:"stbl",children:[{type:"stsd"},{type:"stts"},{type:"stsc"},{type:"stsz"},{type:t.use64Mdat?"co64":"stco"}]}]}]}]}},o=function(t){return[{type:"tfhd"},{type:"tfdt"},{type:"trun"},t.cenc&&(t.cenc.defaultSampleInfoSize||t.cenc.sampleSizes.length)?{type:"saiz"}:null,t.cenc&&(t.cenc.defaultSampleInfoSize||t.cenc.sampleSizes.length)?{type:"saio"}:null,t.cenc?{type:"senc"}:null]}},39108:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var a=i(41450),r=i.n(a);function s(t,e,i){var a;const s=r()(a=i.currentFragment.tracks).call(a,(t=>t.trackId===e.privData.trackId)),n=s?s.baseMediaDecodeTime:BigInt(0);t.writeUint32(20),t.writeString("tfdt"),t.writeUint8(1),t.writeUint24(0),t.writeUint64(n)}},39415:(t,e,i)=>{"use strict";function a(t,e,i){t.writeUint32(28),t.writeString("dref"),t.writeUint32(0),t.writeUint32(1),t.writeUint32(12),t.writeString("url "),t.writeUint32(1)}i.d(e,{A:()=>a})},39712:(t,e,i)=>{"use strict";var a=i(77489);t.exports=a},40675:(t,e,i)=>{"use strict";function a(t,e,i){const a=e.privData.chunkOffsets||[];t.writeUint32(16+4*a.length),t.writeString("stco"),t.writeUint8(0),t.writeUint24(0),t.writeUint32(a.length);for(let e=0;e<a.length;e++)t.writeUint32(Number(a[e]))}i.d(e,{A:()=>a})},43702:(t,e,i)=>{"use strict";i.d(e,{A:()=>T});var a=i(18811),r=i.n(a),s=i(26367),n=i(19859),o=i(16694),c=i(58620),d=i(82846),u=i(54237),f=i(62735),l=i(71846),p=i(11103),h=i(87550),m=i(77102),g=i(80014),k=i(51399),w=i(65407),v=i(65851),b=i(34314),U=i(33236);const I={27:"avc1",173:"hvc1",196:"vvc1",225:"av01",167:"vp09",86019:"ac-3",86056:"ec-3",94226:"wvtt",94232:"stpp",94213:"tx3g"};function P(t){if(t.codecTag)return(0,b.A)(t.codecTag);let e=I[t.codecId];return e||(e=0===t.codecType?"mp4v":1===t.codecType?86076===t.codecId?"Opus":86028===t.codecId?"fLaC":"mp4a":3===t.codecType?"text":"none"),e}function y(t,e,i){const a=e.privData,r=i.cencs[a.trackId],s=t.getPos();t.writeUint32(0),t.writeString("sinf"),t.writeUint32(12),t.writeString("frma"),t.writeString(P(e.codecpar)),t.writeUint32(20),t.writeString("schm"),t.writeUint32(0),t.writeUint32(r.schemeType||(0,U.A)("cenc")),t.writeUint32(r.schemeVersion||65536),t.writeUint32(16+r.defaultKeyId.length+8+(r.defaultConstantIV?1+r.defaultConstantIV.length:0)),t.writeString("schi"),t.writeUint32(16+r.defaultKeyId.length+(r.defaultConstantIV?1+r.defaultConstantIV.length:0)),t.writeString("tenc"),r.cryptByteBlock||r.skipByteBlock||r.pattern?t.writeUint8(1):t.writeUint8(0),t.writeUint24(0),t.writeUint8(0),t.writeUint8((15&(r.cryptByteBlock||0))<<4|15&(r.skipByteBlock||0)),t.writeUint8(1),t.writeUint8(r.defaultPerSampleIVSize),t.writeBuffer(r.defaultKeyId),r.defaultConstantIV&&(t.writeUint8(r.defaultConstantIV.length),t.writeBuffer(r.defaultConstantIV)),i.boxsPositionInfo.push({pos:s,type:"sinf",size:Number(t.getPos()-s)})}function S(t,e,i){const a=i.isom?1:0;t.writeUint32(0),t.writeUint16(0),t.writeUint16(1),t.writeUint16(a),t.writeUint16(0),t.writeUint32(0),i.isom?(t.writeUint16(e.codecpar.chLayout.nbChannels),65541===e.codecpar.codecId||65540===e.codecpar.codecId?t.writeUint16(8):69643===e.codecpar.codecId?t.writeUint16(e.codecpar.bitsPerCodedSample):t.writeUint16(16),t.writeUint16(-2)):(t.writeUint16(e.codecpar.chLayout.nbChannels),86028===e.codecpar.codecId||86032===e.codecpar.codecId?t.writeUint16(e.codecpar.bitsPerRawSample):t.writeUint16(16),t.writeUint16(0)),t.writeUint16(0),86076===e.codecpar.codecId?t.writeUint16(48e3):86060===e.codecpar.codecId?t.writeUint32(e.codecpar.sampleRate):t.writeUint16(e.codecpar.sampleRate),86060!==e.codecpar.codecId&&t.writeUint16(0),1===a&&(t.writeUint32(e.codecpar.frameSize),t.writeUint32(0),t.writeUint32(0),t.writeUint32(2))}function A(t,e,i){const a=P(e.codecpar);!i.isom||86018!==e.codecpar.codecId&&86019!==e.codecpar.codecId&&86056!==e.codecpar.codecId&&73728!==e.codecpar.codecId&&86032!==e.codecpar.codecId&&69638!==e.codecpar.codecId&&69633!==e.codecpar.codecId&&86035!==e.codecpar.codecId?86028===e.codecpar.codecId?(0,f.A)(t,e,i):86076===e.codecpar.codecId?(0,l.A)(t,e,i):86019===e.codecpar.codecId?(0,w.A)(t,e,i):86056===e.codecpar.codecId?(0,v.A)(t,e,i):"mp4a"==a&&(0,p.A)(t,e,i):(0,k.A)(t,e,i)}function B(t,e,i){const a=13==e.codecpar.codecId&&15==e.codecpar.format||13==e.codecpar.codecId&&1==e.codecpar.format||202==e.codecpar.codecId||203==e.codecpar.codecId||156==e.codecpar.codecId||127==e.codecpar.codecId;t.writeUint32(0),t.writeUint16(0),t.writeUint16(1),t.writeUint16(a?2:0),t.writeUint16(0),i.isom?(t.writeString("FFMP"),13===e.codecpar.codecId||a?(t.writeUint32(0),t.writeUint32(1024)):(t.writeUint32(512),t.writeUint32(512))):(t.writeUint32(0),t.writeUint32(0),t.writeUint32(0)),t.writeUint16(e.codecpar.width),t.writeUint16(e.codecpar.height),t.writeUint32(4718592),t.writeUint32(4718592),t.writeUint32(0),t.writeUint16(1);let s=e.metadata.compressorName||"";if(s=r()(s).call(s,0,31),t.writeUint8(s.length),t.writeString(s),s.length<31){let e=31-s.length;for(;e>0;)t.writeUint8(0),e--}i.isom&&e.codecpar.bitsPerCodedSample?t.writeUint16(e.codecpar.bitsPerCodedSample):t.writeUint16(24),t.writeUint16(65535)}function x(t,e,i){"mp4v"===P(e.codecpar)?(0,p.A)(t,e,i):27===e.codecpar.codecId?(0,n.A)(t,e,i):173===e.codecpar.codecId?(0,o.A)(t,e,i):196===e.codecpar.codecId?(0,c.A)(t,e,i):167===e.codecpar.codecId?(0,d.A)(t,e,i):225===e.codecpar.codecId&&(0,u.A)(t,e,i)}function T(t,e,i){const a=t.getPos();t.writeUint32(0),t.writeString("stsd");const r=e.privData,n=i.cencs&&i.cencs[r.trackId]&&(1===e.codecpar.codecType||0===e.codecpar.codecType)&&!i.ignoreEncryption;t.writeUint8(0),t.writeUint24(0),t.writeUint32(n?2:1),1===e.codecpar.codecType?(n&&function(t,e,i){const a=t.getPos();t.writeUint32(0),t.writeString("enca"),S(t,e,i),y(t,e,i),A(t,e,i),i.boxsPositionInfo.push({pos:a,type:"enca",size:Number(t.getPos()-a)})}(t,e,i),function(t,e,i){const a=t.getPos(),r=P(e.codecpar);t.writeUint32(0),t.writeString(r),S(t,e,i),A(t,e,i),i.isom||(0,g.A)(t,e,i),i.boxsPositionInfo.push({pos:a,type:r,size:Number(t.getPos()-a)})}(t,e,i)):0===e.codecpar.codecType?(n&&function(t,e,i){const a=t.getPos();t.writeUint32(0),t.writeString("encv"),B(t,e,i),y(t,e,i),x(t,e,i),i.boxsPositionInfo.push({pos:a,type:"encv",size:Number(t.getPos()-a)})}(t,e,i),function(t,e,i){const a=t.getPos(),r=P(e.codecpar);t.writeUint32(0),t.writeString(r),B(t,e,i),x(t,e,i),(0,h.A)(t,e,i),(0,m.A)(t,e,i),i.isom||(0,g.A)(t,e,i),i.boxsPositionInfo.push({pos:a,type:r,size:Number(t.getPos()-a)})}(t,e,i)):3===e.codecpar.codecType&&function(t,e,i){const a=t.getPos(),r=P(e.codecpar);t.writeUint32(0),t.writeString(r),t.writeUint32(0),t.writeUint16(0),t.writeUint16(1),94208===e.codecpar.codecId?(0,p.A)(t,e,i):e.codecpar.extradata&&t.writeBuffer((0,s.s3)(e.codecpar.extradata,e.codecpar.extradataSize)),i.isom||(0,g.A)(t,e,i),i.boxsPositionInfo.push({pos:a,type:r,size:Number(t.getPos()-a)})}(t,e,i),i.boxsPositionInfo.push({pos:a,type:"esds",size:Number(t.getPos()-a)})}},45602:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var a=i(82563),r=i(51670);class s{constructor(){(0,a.A)(this,"queue",void 0),(0,a.A)(this,"pos",void 0),(0,a.A)(this,"startPos",void 0),(0,a.A)(this,"endPos",void 0),(0,a.A)(this,"index",void 0),(0,a.A)(this,"offset",void 0),this.queue=[],this.startPos=BigInt(0),this.endPos=BigInt(0),this.pos=BigInt(0)}write(t){if(this.pos===this.endPos)this.queue.push(t),this.endPos+=BigInt(t.length),this.pos+=BigInt(t.length);else if(t.length<this.queue[this.index].length-this.offset)this.queue[this.index].set(t,this.offset),this.offset+=t.length,this.pos+=BigInt(t.length),this.offset===this.queue[this.index].length&&(this.index++,this.offset=0),this.index===this.queue.length&&(this.index=-1,this.offset=-1,this.pos=this.endPos);else{let e=0;for(;e<t.length;){const i=Math.min(this.queue[this.index].length-this.offset,t.length-e);if(this.queue[this.index].set(t.subarray(e,e+i),this.offset),e+=i,this.offset+=i,this.pos+=BigInt(i),this.offset===this.queue[this.index].length){if(this.index+1===this.queue.length){if(e<t.length){const i=t.subarray(t.length-e);this.queue.push(i),this.endPos+=BigInt(i.length)}this.pos=this.endPos,this.index=-1,this.offset=-1;break}this.index++,this.offset=0}}}}seek(t){if(t<this.startPos||t>this.endPos)return!1;this.pos=t,this.index=-1,this.offset=-1;let e=this.startPos;for(let i=0;i<this.queue.length;i++){if(t<=e+BigInt(this.queue[i].length)){this.index=i,this.offset=Number(t-e);break}e+=BigInt(this.queue[i].length)}return this.index<0&&(this.pos=this.endPos),!0}flush(){this.startPos=this.endPos,this.pos=this.endPos,this.index=-1,this.offset=-1;const t=(0,r.A)(Uint8Array,this.queue);return this.queue.length=0,t}get size(){return this.queue.length}}},45805:(t,e,i)=>{"use strict";function a(t,e,i){t.writeUint32(12),t.writeString("sthd"),t.writeUint32(0)}i.d(e,{A:()=>a})},46606:(t,e,i)=>{"use strict";i.d(e,{A:()=>r});var a=i(30172);function r(t,e,i){(0,a.A)(t,null,i)}},48920:(t,e,i)=>{"use strict";function a(t,e,i){const a=e.privData.sampleSizes;t.writeUint32(20+4*a.length),t.writeString("stsz"),t.writeUint8(0),t.writeUint24(0),t.writeUint32(0),t.writeUint32(a.length);for(let e=0;e<a.length;e++)t.writeUint32(a[e])}i.d(e,{A:()=>a})},50539:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var a=i(32094),r=i(17283),s=i(46630);function n(t,e,i){const n=e.privData,o=(0,a.A)(n),c=e.metadata.creationTime||0,d=e.metadata.modificationTime||0;let u=21956,f=e.metadata.language;f&&r.Yj(f)&&f.length>=3&&(u=(f.charCodeAt(0)-96&31)<<10|(f.charCodeAt(1)-96&31)<<5|f.charCodeAt(2)-96&31);let l=o<BigInt(s.f7)?0:1;l=c<s.f7?0:1,l=d<s.f7?0:1,t.writeUint32(1===l?44:32),t.writeString("mdhd"),t.writeUint8(l),t.writeUint24(0),1===l?(t.writeUint64(c),t.writeUint64(d)):(t.writeUint32(Number(c)),t.writeUint32(Number(d))),t.writeUint32(e.timeBase.den),1===l?t.writeUint64(o):t.writeUint32(Number(o)),t.writeUint16(u),t.writeUint16(0)}},51399:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var a=i(11103),r=i(26367);function s(t,e,i){const s=t.getPos();t.writeUint32(0),t.writeString("wave"),86035!==e.codecpar.codecId&&(t.writeUint32(12),t.writeString("frma"),t.writeUint32(e.codecpar.codecTag)),86018===e.codecpar.codecId?(t.writeUint32(12),t.writeString("mp4a"),t.writeUint32(0),(0,a.A)(t,e,i)):i.fragment&&e.sideData[1]?(t.writeBuffer(e.sideData[1]),delete e.sideData[1]):e.codecpar.extradata&&t.writeBuffer((0,r.s3)(e.codecpar.extradata,e.codecpar.extradataSize)),t.writeUint32(8),t.writeUint32(0),i.boxsPositionInfo.push({pos:s,type:"wave",size:Number(t.getPos()-s)})}},52214:(t,e,i)=>{"use strict";i.d(e,{A:()=>W});var a=i(82563),r=i(50442),s=i.n(r),n=i(41450),o=i.n(n),c=i(18811),d=i.n(c),u=i(92983),f=i.n(u),l=i(59650),p=i(53508),h=i(66882),m=i(42021),g=i(33236),k=i(20384),w=i(8821),v=i(15167),b=i(19545),U=i(1340),I=i(12660),P=i(18126),y=i(32094),S=i(26367),A=i(75472),B=i(83602),x=i(54163),T=i(46630),D=i(3179),C=i(17283),M=i(21782),z=i(34492),E=i(9984),F=i(82915),N=i(51670),Q=i(1639);const R="packages/avformat/src/formats/OIsobmffFormat.ts",O={fragmentMode:0,mp4Mode:0,fragment:!1,fastOpen:!1,defaultBaseIsMoof:!1,reverseSpsInAvcc:!1,ignoreEncryption:!1,minFragmentLength:5e3,minFragmentIndexLength:5e3,hasTfra:!0,useMetadataTags:!1};class W extends h.A{constructor(t={}){super(),(0,a.A)(this,"type",1),(0,a.A)(this,"context",void 0),(0,a.A)(this,"options",void 0),(0,a.A)(this,"annexb2AvccFilter",void 0),(0,a.A)(this,"avpacket",void 0),this.options=z.extend({},O,t),this.context=(0,m.A)()}init(t){var e;return t.ioWriter.setEndian(!0),s()(e=t.streams).call(e,(t=>{this.annexb2AvccFilter||27!==t.codecpar.codecId&&173!==t.codecpar.codecId&&196!==t.codecpar.codecId||(this.annexb2AvccFilter=new P.A(this.options.reverseSpsInAvcc),this.annexb2AvccFilter.init(t.codecpar[l.o9],t.timeBase[l.o9]))})),this.avpacket=(0,B._5)(),this.context.metadata=t.metadata,this.context.chapters=t.chapters,0}async destroy(t){this.annexb2AvccFilter&&(this.annexb2AvccFilter.destroy(),this.annexb2AvccFilter=null),this.avpacket&&((0,B.Qe)(this.avpacket),this.avpacket=0)}enableStreams(t){const e=[],i=[];for(let t=0;t<5;t++)e[t]=0,i[t]=-1;M.__(t.streams,((t,a)=>{if(-1===t.codecpar.codecType||t.codecpar.codecType>=5||1024&t.disposition)return!0;i[t.codecpar.codecType]<0&&(i[t.codecpar.codecType]=a),1&t.disposition&&(e[t.codecpar.codecType]++,t.privData.flags|=1)}));for(let a=0;a<5;a++)switch(a){case 0:case 1:case 3:e[a]>1&&(t.streams[e[a]].privData.perStreamGrouping=!0),!e[a]&&i[a]>=0&&(t.streams[i[a]].privData.flags|=1)}}writeHeader(t){var e;this.context.majorBrand=(0,g.A)("isom"),this.context.minorVersion=512,this.context.compatibleBrand=[(0,g.A)("isom")],this.context.timescale=1e3,this.context.ignoreEncryption=this.options.ignoreEncryption,this.context.useMetadataTags=this.options.useMetadataTags;const i=o()(e=t.streams).call(e,(t=>1024&t.disposition&&(7===t.codecpar.codecId||61===t.codecpar.codecId||78===t.codecpar.codecId)));if(i&&i.attachedPic&&(this.context.covr={type:27,data:(0,B.iI)(i.attachedPic)},61===i.codecpar.codecId?this.context.covr.type=14:7===i.codecpar.codecId&&(this.context.covr.type=13)),this.options.fragment&&(this.context.compatibleBrand.push((0,g.A)("iso6")),this.context.fragment=!0),1===this.options.mp4Mode&&(this.context.isom=!0,this.context.majorBrand=(0,g.A)("qt "),this.context.compatibleBrand=[this.context.majorBrand]),1!==this.options.mp4Mode){this.context.compatibleBrand.push((0,g.A)("iso2"));const e=t.getStreamByMediaType(0);e&&27===e.codecpar.codecId&&this.context.compatibleBrand.push((0,g.A)("avc1")),this.context.compatibleBrand.push((0,g.A)("mp41"))}if(k.l7(t.ioWriter,this.context),this.context.holdMoovPos=t.ioWriter.getPos(),this.options.fragment)this.context.currentFragment={pos:BigInt(0),currentTrack:null,sequence:1,tracks:[],size:0,firstWrote:!1},M.__(t.streams,((t,e)=>{const i=(0,w.A)();if(t.privData=i,i.chunkOffsets=[],i.cttsSampleCounts=[],i.cttsSampleOffsets=[],i.stscFirstChunk=[],i.stscSamplesPerChunk=[],i.stscSampleDescriptionIndex=[],i.stssSampleNumbers=[],i.sampleSizes=[],i.sttsSampleCounts=[],i.sttsSampleDeltas=[],i.alternateGroup=e,!(1024&t.disposition)){const e=(0,v.A)();e.baseIsMoof=this.options.defaultBaseIsMoof,e.streamIndex=t.index,e.trackId=this.context.nextTrackId++,i.trackId=e.trackId;const a=this.options.encryption||t.metadata.encryption;if(a){const t=this.context.cencs||{};t[e.trackId]={schemeType:a.schemeType,schemeVersion:a.schemeVersion,cryptByteBlock:a.cryptByteBlock,skipByteBlock:a.skipByteBlock,defaultConstantIV:a.constantIV,isProtected:1,defaultPerSampleIVSize:a.perSampleIVSize,defaultKeyId:a.kid,pattern:!!a.pattern},this.context.cencs=t}e.ioWriter=new Q.A,e.ioWriter.onFlush=t=>(e.buffers.push(d()(t).call(t)),0),this.context.currentFragment.tracks.push(e)}})),this.enableStreams(t),k.dI(t.ioWriter,t,this.context),t.ioWriter.flush();else{M.__(t.streams,((t,e)=>{const i=(0,w.A)();t.privData=i,i.trackId=this.context.nextTrackId++,i.chunkOffsets=[],i.cttsSampleCounts=[],i.cttsSampleOffsets=[],i.stscFirstChunk=[],i.stscSamplesPerChunk=[],i.stscSampleDescriptionIndex=[],i.stssSampleNumbers=[],i.sampleSizes=[],i.sttsSampleCounts=[],i.sttsSampleDeltas=[],i.alternateGroup=e})),this.enableStreams(t);const e=t.ioWriter.getPos();t.ioWriter.writeUint32(0),t.ioWriter.writeUint32((0,g.A)("mdat")),this.context.boxsPositionInfo.push({pos:e,type:"mdat",size:0})}return t.getStreamByMediaType(0)||(this.context.audioOnly=!0),0}updateCurrentChunk(t){var e;let i=this.context.currentChunk;if(!i||!i.sampleCount)return;const a=o()(e=t.streams).call(e,(t=>t.index===i.streamIndex)).privData;a.chunkCount++,a.chunkOffsets.push(i.pos),a.stscFirstChunk.length?a.lastStscCount!==i.sampleCount&&(a.stscFirstChunk.push(a.chunkCount),a.stscSamplesPerChunk.push(i.sampleCount),a.stscSampleDescriptionIndex.push(1),a.lastStscCount=i.sampleCount):(a.stscFirstChunk.push(a.chunkCount),a.stscSamplesPerChunk.push(i.sampleCount),a.stscSampleDescriptionIndex.push(1),a.lastStscCount=i.sampleCount)}updateCurrentFragment(t,e){if(this.context.currentFragment.firstWrote){M.__(this.context.currentFragment.tracks,(i=>{var a;const r=o()(a=t.streams).call(a,(t=>t.index===i.streamIndex));if(!i.sampleCount||!r)return!0;const s=r.privData;var n,c;i.baseDataOffset=t.ioWriter.getPos(),this.context.currentFragment.pos=t.ioWriter.getPos(),i.sampleDurations.length?e&&i.sampleDurations.length===i.sampleSizes.length-1&&i.sampleDurations.push(Number(e-s.lastDts)):1===r.codecpar.codecType?e?i.sampleDurations.push(Number(e-s.lastDts)):r.codecpar.frameSize>0?i.sampleDurations.push(Number((0,x.k)(BigInt(Math.floor(r.codecpar.frameSize/r.codecpar.sampleRate*T.SF)),T.KR,r.timeBase))):(r.codecpar.codecId,i.sampleDurations.push(Number((0,x.k)(BigInt(Math.floor(1024/r.codecpar.sampleRate*T.SF)),T.KR,r.timeBase)))):0===r.codecpar.codecType?e?i.sampleDurations.push(Number(e-s.lastDts)):(0,x.lb)(r.codecpar.framerate)>0?i.sampleDurations.push(Number((0,x.k)(BigInt(Math.floor(1/(0,x.lb)(r.codecpar.framerate)*T.SF)),T.KR,r.timeBase))):i.sampleDurations.push(r.timeBase.den/(30*r.timeBase.num)>>>0):i.sampleDurations.push(0),s.lastDuration=i.sampleDurations[i.sampleSizes.length-1],(1===i.sampleFlags.length||(0,I.A)(i.sampleFlags,1))&&(i.firstSampleFlags=i.sampleFlags[0],i.defaultSampleFlags=null!==(n=i.sampleFlags[1])&&void 0!==n?n:i.firstSampleFlags,i.sampleFlags=[]),(1===i.sampleSizes.length||(0,I.A)(i.sampleSizes))&&(i.defaultSampleSize=i.sampleSizes[0],i.sampleSizes=[]),(1===i.sampleDurations.length||(0,I.A)(i.sampleDurations))&&(i.defaultSampleDuration=i.sampleDurations[0],i.sampleDurations=[]),i.cenc&&(1===i.cenc.sampleSizes.length||(0,I.A)(i.cenc.sampleSizes))&&(i.cenc.defaultSampleInfoSize=i.cenc.sampleSizes[0],i.cenc.sampleSizes=[]),1===r.codecpar.codecType?i.defaultSampleFlags=33554432:i.sampleFlags.length&&(i.defaultSampleFlags=i.sampleFlags[0]),i.sampleSizes.length&&(i.defaultSampleSize=i.sampleSizes[0]),i.sampleDurations.length&&(i.defaultSampleDuration=i.sampleDurations[0]),this.options.hasTfra&&(!s.fragIndexes.length||0===this.options.fragmentMode||(0,x.k)(i.baseDataOffset-i.lastFragIndexDts,r.timeBase,T.i0)>=this.options.minFragmentIndexLength)&&(s.fragIndexes.push({pos:i.baseDataOffset,time:i.baseMediaDecodeTime+BigInt(Math.floor(null!==(c=i.sampleCompositionTimeOffset[0])&&void 0!==c?c:0))}),i.lastFragIndexDts=s.lastDts)})),t.ioWriter.flush(),this.options.onFragmentStart&&this.options.onFragmentStart(),k.Ro(t.ioWriter,t,this.context);let i=this.context.currentFragment.size+8;const a=[];let r=8;M.__(this.context.currentFragment.tracks,(e=>{if(!e.sampleCount)return!0;e.ioWriter.flush();const s=(0,N.A)(Uint8Array,e.buffers);e.dataOffset=i,i+=s.length,r+=s.length,a.push(s),(0,U.A)(t.ioWriter,e.dataOffsetPos,e.dataOffset,"int32"),e.cenc&&e.cenc.offsetPos&&(0,U.A)(t.ioWriter,e.cenc.offsetPos,e.cenc.offset,"int32"),e.buffers=[],e.sampleFlags=[],e.sampleSizes=[],e.sampleDurations=[],e.sampleCompositionTimeOffset=[],e.sampleCount=0,e.firstSampleFlags=0,e.cenc=null})),t.ioWriter.writeUint32(r),t.ioWriter.writeUint32((0,g.A)("mdat")),M.__(a,(e=>{t.ioWriter.writeBuffer(e)})),(0,b.A)(t.ioWriter,this.context),t.ioWriter.flush(),this.context.currentFragment.firstWrote=!1,this.context.currentFragment.sequence++}}handleEAC3(t,e){this.context.ac3Info||(this.context.ac3Info={done:!1,numBlocks:0,dataRate:0,ac3BitrateCode:-1,numIndSub:0,substream:[]});const i=this.context.ac3Info,a=D.R((0,S.s3)(p.f[20](t+24),p.f[15](t+28)));if(C.ai(a))i.done=!0;else if(i.dataRate=Math.max(i.dataRate,a.bitrate/1e3),i.ac3BitrateCode=Math.max(i.ac3BitrateCode,a.ac3BitrateCode),!i.done){if(a.bitstreamId<=10&&0!=a.substreamId)return;if(0===a.frameType||2==a.frameType){var r;if(a.substreamId>i.numIndSub+1)return;if(a.substreamId==i.numIndSub+1)return;if(a.substreamId<i.numIndSub||0==a.substreamId&&null!==(r=i.substream[0])&&void 0!==r&&r.bsid)return void(i.done=!0)}else if(0!=a.substreamId)return;if(i.substream[a.substreamId]||(i.substream[a.substreamId]={fscod:0,bsid:0,bsmod:0,acmod:0,lfeon:0,numDepSub:0,chanLoc:0}),i.substream[a.substreamId].fscod=a.srCode,i.substream[a.substreamId].bsid=a.bitstreamId,i.substream[a.substreamId].bsmod=a.bitstreamMode,i.substream[a.substreamId].acmod=a.channelMode,i.substream[a.substreamId].lfeon=a.lfeOn,86019===e.codecpar.codecId)return void(i.done=!0)}}writeTrackData(t,e,i,a){if(94226===a.codecpar.codecId){const s=a.privData;if(s.lastDuration>0){const n=s.lastDts+BigInt(Math.floor(s.lastDuration));if(n<i&&(0,x.k)(i-n,a.timeBase,T.i0)>200){t.writeUint32(8),t.writeString("vtte");const a=Number(i-n);if(this.context.fragment){var r;const t=o()(r=this.context.currentFragment.tracks).call(r,(t=>t.streamIndex===p.f[15](e+32)));t.sampleCount++,t.sampleSizes.length||(t.baseMediaDecodeTime=n),t.sampleDurations.push(a),t.sampleSizes.push(8)}else{const t=Number(n-s.lastDts);this.context.currentChunk.sampleCount++,s.sampleSizes.push(8),s.sttsSampleDeltas[s.sttsSampleDeltas.length-1]===t?s.sttsSampleCounts[s.sttsSampleCounts.length-1]++:(s.sttsSampleCounts.push(1),s.sttsSampleDeltas.push(t))}s.lastPts=n,s.lastDts=n,s.lastDuration=a}}const n=(0,B.rU)(e,16),c=(0,B.rU)(e,17);let d=p.f[15](e+28)+8;return n&&(d+=8+(0|p.f[25](n+4))),c&&(d+=8+(0|p.f[25](c+4))),t.writeUint32(8+d),t.writeString("vttc"),n&&(t.writeUint32(8+p.f[25](n+4)),t.writeString("iden"),t.writeBuffer((0,S.s3)(p.f[20](n),p.f[25](n+4)))),c&&(t.writeUint32(8+p.f[25](c+4)),t.writeString("sttg"),t.writeBuffer((0,S.s3)(p.f[20](c),p.f[25](c+4)))),t.writeUint32(8+p.f[15](e+28)),t.writeString("payl"),t.writeBuffer((0,B.iI)(e)),8+d}return t.writeBuffer((0,B.iI)(e)),p.f[15](e+28)}writeAVPacket(t,e){if(!p.f[15](e+28))return F.R8(`packet's size is 0: ${p.f[15](e+32)}, ignore it`,R,781),0;const i=t.getStreamByIndex(p.f[15](e+32));if(!i||1024&i.disposition)return void F.R8(`can not found the stream width the avpacket's streamIndex: ${p.f[15](e+32)}, ignore it`,R,788);const a=i.privData;let r=(0,x.Mr)(p.f[17](e+16),e+72,i.timeBase),s=(0,x.Mr)(p.f[17](e+8)!==T.Dh?p.f[17](e+8):p.f[17](e+16),e+72,i.timeBase);const n=p.f[17](e+48)!==T.Dh?(0,x.Mr)(p.f[17](e+48),e+72,i.timeBase):T.Dh;if((27===i.codecpar.codecId||173===i.codecpar.codecId||196===i.codecpar.codecId)&&64&p.f[15](e+36)?(this.annexb2AvccFilter.sendAVPacket(e),this.annexb2AvccFilter.receiveAVPacket(this.avpacket),e=this.avpacket):86019!==i.codecpar.codecId&&86056!==i.codecpar.codecId||this.context.ac3Info&&this.context.ac3Info.done||this.handleEAC3(e,i),this.context.fragment){var c;const u=o()(c=this.context.currentFragment.tracks).call(c,(t=>t.streamIndex===p.f[15](e+32)));if(u){u.tfdtDelay===T.Dh&&(u.tfdtDelay=r<0?-r:BigInt(0),s<0&&(u.trunPtsDelay=u.tfdtDelay)),r+=u.tfdtDelay,s+=u.trunPtsDelay,(0===this.options.fragmentMode&&(0===i.codecpar.codecType&&1&p.f[15](e+36)||this.context.audioOnly&&(0,x.k)(r-u.baseMediaDecodeTime,i.timeBase,T.i0)>=this.options.minFragmentLength)||1===this.options.fragmentMode)&&(1===this.context.currentFragment.tracks.length?this.updateCurrentFragment(t,r):this.updateCurrentFragment(t));const o=this.writeTrackData(u.ioWriter,e,r,i);if(u.sampleSizes.length||(u.baseMediaDecodeTime=r),u.sampleSizes.length&&(!u.sampleDurations[u.sampleSizes.length-1]||u.sampleDurations[u.sampleSizes.length-1]<=0)&&(u.sampleDurations[u.sampleSizes.length-1]=Number(r-a.lastDts)),n>0&&u.sampleDurations.push(Number(n)),u.sampleSizes.push(o),0===i.codecpar.codecType){let t=0;1&p.f[15](e+36)?t|=33554432:t|=16842752,u.sampleCompositionTimeOffset.push(Number((s!==T.Dh?s:r)-r)),u.sampleFlags.push(t)}const c=(0,B.Un)(e+40,e+44,25),l=this.context.cencs&&this.context.cencs[a.trackId];if(c&&l){const t=(0,A.p$)((0,S.s3)(p.f[20](c),p.f[25](c+4)));var d;if(u.cenc||(u.cenc={sampleCount:0,defaultSampleInfoSize:0,sampleSizes:[],offset:0,useSubsamples:!1,sampleInfoOffset:[],sampleEncryption:[]}),t.subsamples.length)!u.cenc.useSubsamples&&u.cenc.sampleSizes.length&&(u.cenc.sampleSizes=f()(d=u.cenc.sampleSizes).call(d,(t=>t+2))),u.cenc.useSubsamples=!0;u.cenc.sampleCount++,u.cenc.sampleSizes.push(l.defaultPerSampleIVSize+(u.cenc.useSubsamples?2+6*t.subsamples.length:0)),u.cenc.sampleEncryption.push({iv:t.iv,subsamples:t.subsamples})}u.sampleCount++,a.lastPts=E.T9(a.lastPts,s+(n!==T.Dh?n:BigInt(0))),a.lastDts=r,n>0&&(a.lastDuration=Number(n)),this.context.currentFragment.firstWrote=!0}else F.R8(`can not found track width streamIndex ${p.f[15](e+32)}, ignore it`,R,926)}else{const o=t.ioWriter.getPos();let c=this.context.currentChunk;if(c?c.streamIndex!==p.f[15](e+32)?(this.updateCurrentChunk(t),c.streamIndex=p.f[15](e+32),c.sampleCount=1,c.pos=o):c.sampleCount++:c=this.context.currentChunk={pos:o,streamIndex:p.f[15](e+32),sampleCount:1},a.sampleSizes.push(this.writeTrackData(t.ioWriter,e,r,i)),0===i.codecpar.codecType&&1&p.f[15](e+36)&&a.stssSampleNumbers.push(a.sampleSizes.length),a.firstWrote){const t=Number(r-a.lastDts);a.sttsSampleDeltas[a.sttsSampleDeltas.length-1]===t?a.sttsSampleCounts[a.sttsSampleCounts.length-1]++:(a.sttsSampleCounts.push(1),a.sttsSampleDeltas.push(t))}else a.startDts=r,a.startCT=Number((s!==T.Dh?s:r)-r),a.firstWrote=!0;if(s>=0&&(a.startPts===T.Dh?a.startPts=s:a.startPts=E.jk(a.startPts,s)),0===i.codecpar.codecType){const t=Number((s!==T.Dh?s:r)-r);a.cttsSampleCounts.length&&a.cttsSampleOffsets[a.cttsSampleOffsets.length-1]===t?a.cttsSampleCounts[a.cttsSampleCounts.length-1]++:(a.cttsSampleCounts.push(1),a.cttsSampleOffsets.push(t))}a.lastPts=E.T9(a.lastPts,s+(n!==T.Dh?n:BigInt(0))),a.lastDts=r,a.lastDuration=Number(n)}return 0}writeTrailer(t){if(this.context.fragment)M.__(this.context.currentFragment.tracks,(e=>{var i;const a=o()(i=t.streams).call(i,(t=>t.index===e.streamIndex)).privData;e.sampleCount&&(e.sampleDurations.length?e.sampleDurations.push(e.sampleDurations[e.sampleDurations.length-1]):e.sampleDurations=[a.lastDuration])})),this.updateCurrentFragment(t),this.options.hasTfra?k.yT(t.ioWriter,t,this.context):(t.ioWriter.writeUint32(8),t.ioWriter.writeString("mfra")),t.ioWriter.flush();else{this.updateCurrentChunk(t);let e=BigInt(0);M.__(t.streams,(t=>{if(1024&t.disposition)return!0;const i=t.privData;i.sampleSizes.length&&(i.sttsSampleDeltas.length?i.lastDuration>0&&i.lastDuration!==i.sttsSampleDeltas[i.sttsSampleDeltas.length-1]?(i.sttsSampleCounts.push(1),i.sttsSampleDeltas.push(i.lastDuration)):i.sttsSampleCounts[i.sttsSampleCounts.length-1]++:(i.sttsSampleCounts=[1],i.sttsSampleDeltas=[0]));const a=(0,x.k)((0,y.A)(i),t.timeBase,{den:1e3,num:1});a>e&&(e=a)})),this.context.duration=e;const i=this.context.boxsPositionInfo[this.context.boxsPositionInfo.length-1];if("mdat"!==i.type&&F.z3("last box is not mdat",R,1053),i.size=Number(t.ioWriter.getPos()-i.pos),i.size>T.f7){const e=t.ioWriter.getPos();t.ioWriter.seek(i.pos-BigInt(8)),t.ioWriter.writeUint32(1),t.ioWriter.writeUint32((0,g.A)("mdat")),t.ioWriter.writeUint64(BigInt(i.size)+BigInt(8)),t.ioWriter.seek(e),this.context.boxsPositionInfo.pop(),this.context.use64Mdat=!0}if((0,b.A)(t.ioWriter,this.context),this.options.fastOpen){t.ioWriter.flush();let e=[];const i=t.ioWriter.onFlush;t.ioWriter.onFlush=t=>(e.push(d()(t).call(t)),0),k.dI(t.ioWriter,t,this.context),t.ioWriter.flush();let a=(0,N.A)(Uint8Array,e);M.__(t.streams,(t=>{const e=t.privData;if(e.chunkOffsets.length)for(let t=0;t<e.chunkOffsets.length;t++)e.chunkOffsets[t]+=BigInt(Math.floor(a.length))})),e=[],k.dI(t.ioWriter,t,this.context),t.ioWriter.flush(),a=(0,N.A)(Uint8Array,e),i&&i(a,this.context.holdMoovPos),t.ioWriter.onFlush=i}else k.dI(t.ioWriter,t,this.context),t.ioWriter.flush()}return 0}flush(t){return this.options.fragment&&(M.__(this.context.currentFragment.tracks,(e=>{var i;const a=o()(i=t.streams).call(i,(t=>t.index===e.streamIndex)).privData;e.sampleCount&&(e.sampleDurations.length?e.sampleDurations.push(e.sampleDurations[e.sampleDurations.length-1]):e.sampleDurations=[a.lastDuration])})),this.updateCurrentFragment(t)),t.ioWriter.flush(),0}getCapabilities(){return W.Capabilities}}(0,a.A)(W,"Capabilities",[86021,86076,86018,86017,86028,86051,86019,86056,167,225,27,173,196,12,94226,94213])},52728:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var a=i(41450),r=i.n(a);function s(t,e,i){var a;const s=r()(a=i.currentFragment.tracks).call(a,(t=>t.trackId===e.privData.trackId));let n=57;s.baseIsMoof&&(n&=-2,n|=131072);const o=t.getPos();t.writeUint32(0),t.writeString("tfhd"),t.writeUint8(0),t.writeUint24(n),t.writeUint32(s.trackId),1&n&&t.writeUint64(s.baseDataOffset),8&n&&t.writeUint32(s.defaultSampleDuration),16&n&&t.writeUint32(s.defaultSampleSize),32&n&&t.writeUint32(s.defaultSampleFlags),i.boxsPositionInfo.push({pos:o,type:"tfhd",size:Number(t.getPos()-o)})}},54237:(t,e,i)=>{"use strict";i.d(e,{A:()=>r});var a=i(26367);function r(t,e,i){var r;t.writeUint32(8+(null!==(r=e.codecpar.extradataSize)&&void 0!==r?r:0)),t.writeString("av1C"),i.fragment&&e.sideData[1]?(t.writeBuffer(e.sideData[1]),delete e.sideData[1]):e.codecpar.extradata&&t.writeBuffer((0,a.s3)(e.codecpar.extradata,e.codecpar.extradataSize))}},55013:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var a=i(41450),r=i.n(a),s=i(50442),n=i.n(s);function o(t,e,i){var a,s;const o=r()(a=i.currentFragment.tracks).call(a,(t=>t.trackId===e.privData.trackId)),c=i.cencs?i.cencs[o.trackId]:null,d=t.getPos();t.writeUint32(0),t.writeString("senc"),t.writeUint32(o.cenc.useSubsamples?2:0),t.writeUint32(o.cenc.sampleEncryption.length),o.cenc.offset=Number(t.getPos()-i.currentFragment.pos),n()(s=o.cenc.sampleEncryption).call(s,(e=>{var i;c.defaultPerSampleIVSize&&t.writeBuffer(e.iv),o.cenc.useSubsamples&&(t.writeUint16(e.subsamples.length),n()(i=e.subsamples).call(i,(e=>{t.writeUint16(e.bytesOfClearData),t.writeUint32(e.bytesOfProtectedData)})))})),i.boxsPositionInfo.push({pos:d,type:"senc",size:Number(t.getPos()-d)})}},57247:(t,e,i)=>{"use strict";function a(t,e,i){t.writeUint32(20),t.writeString("vmhd"),t.writeUint8(0),t.writeUint24(1),t.writeUint64(BigInt(0))}i.d(e,{A:()=>a})},58620:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var a=i(26367),r=i(99723),s=i(60783);function n(t,e,i){let n;i.fragment&&e.sideData[1]?(n=e.sideData[1],delete e.sideData[1]):e.codecpar.extradata&&(n=(0,a.s3)(e.codecpar.extradata,e.codecpar.extradataSize)),n&&s.Bs(n)&&(n=r.S1(n)),t.writeUint32(12+(n?n.length:0)),t.writeString("vvcC"),t.writeUint8(0),t.writeUint24(0),n&&t.writeBuffer(n)}},61263:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var a=i(82915);const r="packages/avformat/src/formats/isobmff/writing/stsc.ts";function s(t,e,i){const s=e.privData,n=s.stscFirstChunk,o=s.stscSamplesPerChunk,c=s.stscSampleDescriptionIndex;n.length===o.length&&n.length===c.length||a.R8("ctts firstChunk's length is not match samplesPerChunk's length or sampleDescriptionIndex's length",r,42);const d=Math.min(n.length,o.length,c.length);t.writeUint32(16+12*d),t.writeString("stsc"),t.writeUint8(0),t.writeUint24(0),t.writeUint32(d);for(let e=0;e<d;e++)t.writeUint32(n[e]),t.writeUint32(o[e]),t.writeUint32(c[e])}},62735:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var a=i(82915),r=i(26367),s=i(80490);const n="packages/avformat/src/formats/isobmff/writing/dfla.ts";function o(t,e,i){let o;i.fragment&&e.sideData[1]?(o=e.sideData[1],delete e.sideData[1]):e.codecpar.extradata&&(o=(0,r.s3)(e.codecpar.extradata,e.codecpar.extradataSize)),o&&o.length===s.ob?(t.writeUint32(o.length+16),t.writeString("dfLa"),t.writeUint8(0),t.writeUint24(0),t.writeUint8(128),t.writeUint24(o.length),t.writeBuffer(o)):a.z3("invalid extradata",n,55)}},65407:(t,e,i)=>{"use strict";i.d(e,{A:()=>r});var a=i(9471);function r(t,e,i){t.writeUint32(11),t.writeString("dac3");const r=new a.A(3),s=i.ac3Info;r.writeU(2,s.substream[0].fscod),r.writeU(5,s.substream[0].bsid),r.writeU(3,s.substream[0].bsmod),r.writeU(3,s.substream[0].acmod),r.writeU(1,s.substream[0].lfeon),r.writeU(5,s.ac3BitrateCode),r.writeU(5,0),t.writeBuffer(r.getBuffer())}},65851:(t,e,i)=>{"use strict";i.d(e,{A:()=>r});var a=i(9471);function r(t,e,i){const r=i.ac3Info,s=new a.A(2+(34*(r.numIndSub+1)+7>>3));s.writeU(13,r.dataRate),s.writeU(3,r.numIndSub);for(let t=0;t<r.numIndSub;t++)s.writeU(2,r.substream[t].fscod),s.writeU(5,r.substream[t].bsid),s.writeU(1,0),s.writeU(1,0),s.writeU(3,r.substream[t].bsmod),s.writeU(3,r.substream[t].acmod),s.writeU(1,r.substream[t].lfeon),s.writeU(5,0),s.writeU(4,r.substream[t].numDepSub),r.substream[t].numDepSub?s.writeU(9,r.substream[t].chanLoc):s.writeU(1,0);s.padding();const n=s.getPointer();t.writeUint32(8+n),t.writeString("dec3"),t.writeBuffer(s.getBuffer().subarray(0,n))}},66380:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var a=i(82915);const r="packages/avformat/src/formats/isobmff/writing/stts.ts";function s(t,e,i){const s=e.privData,n=s.sttsSampleCounts||[],o=s.sttsSampleDeltas||[];n.length!==o.length&&a.R8("stts sampleCounts's length is not match sampleDeltas's length",r,39);const c=Math.min(n.length,o.length);t.writeUint32(16+8*c),t.writeString("stts"),t.writeUint8(0),t.writeUint24(0),t.writeUint32(c);for(let e=0;e<c;e++)t.writeUint32(n[e]),t.writeInt32(o[e])}},66882:(t,e,i)=>{"use strict";i.d(e,{A:()=>r});var a=i(82563);class r{constructor(){(0,a.A)(this,"type",-1)}async destroy(t){}}(0,a.A)(r,"Capabilities",[])},67236:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>Z});var a=i(18811),r=i.n(a),s=i(63856),n=i.n(s),o=i(42399),c=i.n(o),d=i(50442),u=i.n(d),f=i(26367),l=i(59650),p=i(53508),h=i(25149),m=i(35536),g=i(3029),k=i(55671),w=i(58650),v=i(83602),b=i(63624),U=i(10559),I=i(54163),P=i(46630),y=i(19611),S=i(45912),A=i(75211),B=i(24578),x=i(61111),T=i(24540),D=i(21464),C=i(45200),M=i(98238),z=i(51155),E=i(43129),F=i(17283),N=i(9984),Q=i(82915),R=i(79579),O=i(1639),W=i(45602),_=i(13135),V=i(10129),q=i(3775),L=i(68762),$=i(67517),Y=i(90120),K=i(52214),H=i(33236),X=i(21991),G=i(98726),j=i(28705);const J="packages/avplayer/src/mse/MSEPipeline.ts";class Z extends G.A{constructor(){super()}async syncToKeyframe(t){let e=!0;if(t.video){let a;for(;;){if(t.video.backPacket=await this.pullAVPacket(t.video,t),t.video.backPacket<0){t.video.packetEnded=!0,t.video.backPacket=0;break}if(t.audio&&!t.audio.packetEnded&&(!t.audio.backPacket||(0,I.Mr)(p.f[17](t.audio.backPacket+8),t.audio.backPacket+72,P.i0)<(0,I.Mr)(p.f[17](t.video.backPacket+8),t.video.backPacket+72,P.i0)))for(;;){if(t.audio.backPacket>0){const e=(0,v.rU)(t.audio.backPacket,1);var i;e&&(a=r()(i=(0,f.s3)(p.f[20](e),p.f[25](e+4))).call(i)),t.avpacketPool.release(t.audio.backPacket)}if(t.audio.backPacket=await this.pullAVPacket(t.audio,t),t.audio.backPacket<0){t.audio.packetEnded=!0,t.audio.backPacket=0;break}if((0,I.Mr)(p.f[17](t.audio.backPacket+8),t.audio.backPacket+72,P.i0)>(0,I.Mr)(p.f[17](t.video.backPacket+8),t.video.backPacket+72,P.i0))break}if(1&p.f[15](t.video.backPacket+36)||27===p.f[15](t.video.codecpar+4)&&T.KD(t.video.backPacket,p.f[20](t.video.codecpar+12)?1+(3&S.r8(p.f[20](t.video.codecpar+12)+4)):4)||173===p.f[15](t.video.codecpar+4)&&D.KD(t.video.backPacket,p.f[20](t.video.codecpar+12)?1+(3&S.r8(p.f[20](t.video.codecpar+12)+21)):4))break;e=!1,t.avpacketPool.release(t.video.backPacket)}if(t.audio&&t.audio.backPacket&&!(0,v.fQ)(t.audio.backPacket,1)&&a){const e=(0,b.sY)(a.length);(0,f.lW)(e,a.length,a),(0,v.Ow)(t.audio.backPacket,1,e,a.length)}}return e}getSourceOpenHandler(t,e=BigInt(0)){return async()=>{var i,a;await this.syncToKeyframe(t);let r=e,s=e;if(!t.audio||t.audio.backPacket||t.audio.packetEnded||(t.audio.backPacket=await this.pullAVPacket(t.audio,t),t.audio.backPacket<0&&(t.audio.packetEnded=!0,t.audio.backPacket=0)),t.video&&!t.video.backPacket&&t.video.packetEnded&&(t.video.backPacket=await this.pullAVPacket(t.video,t),t.video.backPacket<0&&(t.video.packetEnded=!0,t.video.backPacket=0)),(null===(i=t.audio)||void 0===i?void 0:i.backPacket)>0&&(r=N.T9(r,(0,I.Mr)(p.f[17](t.audio.backPacket+16),t.audio.backPacket+72,P.i0))),(null===(a=t.video)||void 0===a?void 0:a.backPacket)>0&&(s=N.T9(s,(0,I.Mr)(p.f[17](t.video.backPacket+16),t.video.backPacket+72,P.i0))),t.audio&&t.video&&N.tn(r-s)>1e3)if(s>r){const e=(0,I.k)(r,P.i0,(0,h.A)(t.video.backPacket+72,m.Q));g.M[17](t.video.backPacket+48,p.f[17](t.video.backPacket+16)-e),g.M[17](t.video.backPacket+16,e),g.M[17](t.video.backPacket+8,e),s=r}else if(r>s&&86018===t.audio.oformatContext.streams[0].codecpar.codecId&&2===t.audio.oformatContext.streams[0].codecpar.profile&&t.audio.oformatContext.streams[0].codecpar.chLayout.nbChannels<3){const e=t.avpacketPool.alloc();(0,v.rN)(e,t.audio.backPacket);const i=1===t.audio.oformatContext.streams[0].codecpar.chLayout.nbChannels?new Uint8Array([0,200,0,128,35,128]):new Uint8Array([33,0,73,144,2,25,0,35,128]),a=(0,b.sY)(i.length);(0,f.lW)(a,i.length,i),(0,v.NX)(e,a,i.length),g.M[17](e+16,(0,I.k)(s,P.i0,(0,h.A)(e+72,m.Q))),g.M[17](e+8,(0,I.k)(s,P.i0,(0,h.A)(e+72,m.Q)));const n=BigInt(1024e3)/BigInt(0|t.audio.oformatContext.streams[0].codecpar.sampleRate),o=Number(BigInt.asIntN(32,(r-s)/n));let c=p.f[17](e+16)+(0,I.k)(n,P.i0,(0,h.A)(t.audio.backPacket+72,m.Q));for(let i=0;i<o-1;i++){const i=t.avpacketPool.alloc();(0,v.rN)(i,e),g.M[17](i+16,c),g.M[17](i+8,c),t.audio.pullQueue.queue.push(i),c+=(0,I.k)(n,P.i0,(0,h.A)(t.audio.backPacket+72,m.Q))}t.audio.pullQueue.queue.push(t.audio.backPacket),t.audio.backPacket=e,r=s}const o=[];t.audio&&(t.audio.track.setSourceBuffer(this.createSourceBuffer(t.mediaSource,t.audio.oformatContext.streams[0].codecpar[l.o9])),t.audio.enableRawMpeg||($.ho(t.audio.oformatContext),$.bx(t.audio.oformatContext)),o.push(this.startMux(t.audio,t,N.T9(r,s)))),t.video&&(t.video.track.setSourceBuffer(this.createSourceBuffer(t.mediaSource,t.video.oformatContext.streams[0].codecpar[l.o9])),t.video.enableRawMpeg||($.ho(t.video.oformatContext),$.bx(t.video.oformatContext)),o.push(this.startMux(t.video,t,N.T9(r,s)))),await n().all(o);let c=!1,d=!1;t.audio&&(t.audio.backPacket=await this.pullAVPacket(t.audio,t),t.audio.backPacket>0?(c=!0,t.audio.frontPacket=await this.pullAVPacket(t.audio,t),t.audio.frontPacket>0?t.audio.frontBuffered=!0:(t.audio.frontPacket=0,t.audio.packetEnded=!0)):t.audio.packetEnded=!0,t.audio.enableRawMpeg||t.audio.oformatContext.ioWriter.flush(),t.audio.track.addBuffer(t.audio.bufferQueue.flush())),t.video&&(t.video.backPacket=await this.pullAVPacket(t.video,t),t.video.backPacket>0?(d=!0,t.video.frontPacket=await this.pullAVPacket(t.video,t),t.video.frontPacket>0?t.video.frontBuffered=!0:(t.video.frontPacket=0,t.video.packetEnded=!0)):t.video.packetEnded=!0,t.video.enableRawMpeg||t.video.oformatContext.ioWriter.flush(),t.video.track.addBuffer(t.video.bufferQueue.flush())),t.audio&&(c?(this.createLoop(t.audio,t),t.audio.loop.start()):t.audio.track.end()),t.video&&(d?(this.createLoop(t.video,t),t.video.loop.start()):t.video.track.end()),await new _.A(.1);let u=0;t.audio?u=t.video?Math.max(t.audio.track.getBufferedStart(),t.video.track.getBufferedStart()):t.audio.track.getBufferedStart():t.video&&(u=t.video.track.getBufferedStart()),t.currentTimeNTP=(0,R.A)(),e>BigInt(0)?(t.currentTime=C.yw(e),t.controlIPCPort.notify("seek",{time:t.currentTime})):(z.A.safari||E.A.ios||u>.1||t.playRate>BigInt(100))&&(t.currentTime=u,t.currentTimeNTP=(0,R.A)(),t.controlIPCPort.notify("seek",{time:u}))}}getMimeType(t){let e="";return 1===p.f[15](t)?e=(0,A.A)(t):0===p.f[15](t)&&(e=(0,B.A)(t)),e||Q.h2("invalid stream",J,515),e}createSourceBuffer(t,e){return t.addSourceBuffer(this.getMimeType(e))}mixExtradata(t,e,i){const a=t.oformatContext.streams[0].codecpar;a.extradata&&(0,b.Eb)(a.extradata),a.extradata=(0,b.sY)(i),(0,f.Mr)(a.extradata,e,i),a.extradataSize=i,27===a.codecId?T.XC(t.oformatContext.streams[0],(0,f.s3)(e,i)):173===a.codecId&&D.XC(t.oformatContext.streams[0],(0,f.s3)(e,i)),t.track.changeMimeType(this.getMimeType(a[l.o9]),t.enableRawMpeg?"sequence":"segments");const r=new K.A({fragmentMode:1,fragment:!0,fastOpen:!0,mp4Mode:0,defaultBaseIsMoof:!0,reverseSpsInAvcc:!0,hasTfra:!1});t.oformatContext.oformat=r,t.timestampOffsetUpdated=!1,t.enableRawMpeg||($.ho(t.oformatContext),$.bx(t.oformatContext))}checkEnableEncryption(t,e){if(t.oformatContext.streams[0].metadata.encryption){const i=(0,v.fQ)(e,25);if(!i&&!t.ignoreEncryption||i&&t.ignoreEncryption){t.track.changeMimeType(this.getMimeType(t.oformatContext.streams[0].codecpar[l.o9]),t.enableRawMpeg?"sequence":"segments");const e=new K.A({fragmentMode:1,fragment:!0,fastOpen:!0,mp4Mode:0,defaultBaseIsMoof:!0,reverseSpsInAvcc:!0,ignoreEncryption:!i,hasTfra:!1});t.ignoreEncryption=!i,t.oformatContext.oformat=e,t.timestampOffsetUpdated=!1,t.enableRawMpeg||($.ho(t.oformatContext),$.bx(t.oformatContext))}}}async pullAVPacketInternal(t,e){const i=await e.request("pull");if(F.ai(i)||(0,M.A)(i))return i;{const e=t.avpacketPool.alloc();return(0,U.r0)(i,e),e}}async pullAVPacket(t,e){const i=t.pullQueue;if(i.ended&&!i.queue.length)return-1048576;const a=i.queue.length?i.queue.shift():await this.pullAVPacketInternal(e,t.pullIPC);if(a<0)return i.ended=!0,-1048576;if(p.f[17](a+16)<BigInt(0))return a;if(p.f[17](a+16)<i.lastDTS&&Q.R8(`got packet with dts ${p.f[17](a+16)}, which is earlier then the last packet(${i.lastDTS})`,J,627),g.M[17](a+48,P.Dh),"audio"===t.type&&p.f[17](a+16)>0)g.M[17](a+8,p.f[17](a+16));else if("video"===t.type&&!e.isLive)if(1&p.f[15](a+36)&&(27===p.f[15](e.video.codecpar+4)&&T.KD(a,p.f[20](e.video.codecpar+12)?1+(3&S.r8(p.f[20](e.video.codecpar+12)+4)):4)||173===p.f[15](e.video.codecpar+4)&&D.KD(a,p.f[20](e.video.codecpar+12)?1+(3&S.r8(p.f[20](e.video.codecpar+12)+21)):4)))if(p.f[17](a+8)<i.lastPTS){Q.R8(`got video packet with pts ${p.f[17](a+8)}, which is earlier then the last packet(${i.lastPTS}), try to fix it!`,J,664),g.M[17](a+8,i.lastPTS+(p.f[17](a+16)-i.lastDTS));const r=await this.pullAVPacketInternal(e,t.pullIPC);if(r<0)i.ended=!0;else{i.queue.push(r);let s=p.f[17](r+8);const n=p.f[17](r+8);for(;;){const a=await this.pullAVPacketInternal(e,t.pullIPC);if(a<0){i.ended=!0;break}if(i.queue.push(a),p.f[17](a+8)>n)break;s=N.jk(s,p.f[17](a+8))}s<p.f[17](a+8)&&(i.diff=p.f[17](a+16)-i.lastDTS)}}else i.diff=BigInt(0);else g.M[17](a+8,p.f[17](a+8)+i.diff);return p.f[17](a+8)>i.lastPTS&&(i.lastPTS=p.f[17](a+8)),i.lastDTS=p.f[17](a+16),"audio"===t.type&&i.useSampleRateTimeBase&&(i.frameCount===P.Dh?(i.frameCount=(0,I.Mr)(p.f[17](a+16),a+72,t.oformatContext.streams[0].timeBase),g.M[17](a+16,i.frameCount),g.M[17](a+8,i.frameCount)):(i.frameCount=i.frameCount+BigInt(0|p.f[15](t.codecpar+144)),g.M[17](a+16,i.frameCount),g.M[17](a+8,i.frameCount)),(0,f.Mr)(a+72,t.oformatContext.streams[0].timeBase[l.o9],8)),a}writeAVPacket(t,e,i=!1){if(e.enableRawMpeg){var a;if(!e.timestampOffsetUpdated){const i=(0,I.Mr)(p.f[17](t+8),t+72,P.i0);e.track.updateTimestampOffset(Number(BigInt.asIntN(32,i))/1e3),e.timestampOffsetUpdated=!0}e.bufferQueue.write(r()(a=(0,f.s3)(p.f[20](t+24),p.f[15](t+28))).call(a))}else{if("video"===e.type&&1&p.f[15](t+36)||"audio"===e.type){const i=(0,v.rU)(t,1);i&&function(t,e,i,a){if(e!==a)return!0;let r=!1;for(let a=0;a<e;a++)if(p.f[2](t+a)!==p.f[2](i+a)){r=!0;break}return r}(e.oformatContext.streams[0].codecpar.extradata,e.oformatContext.streams[0].codecpar.extradataSize,p.f[20](i),0|p.f[25](i+4))&&this.mixExtradata(e,p.f[20](i),0|p.f[25](i+4))}this.checkEnableEncryption(e,t),$.XA(e.oformatContext,t),i&&e.oformatContext.ioWriter.flush()}}swap(t,e){if(t.backPacket&&e.avpacketPool.release(t.backPacket),t.backPacket=0,!t.frontBuffered)return!1;t.backPacket=t.frontPacket,t.frontPacket=0,t.frontBuffered=!1;const i=(0,R.A)();return this.pullAVPacket(t,e).then((a=>{if(a<0)return t.packetEnded=!0,void(t.frontPacket=0);const r=(0,R.A)()-i;r>5&&(t.startTimestamp+=BigInt(Math.floor(r))),t.frontPacket=a,t.frontBuffered=!0,t.seekSync&&(t.seekSync(),t.seekSync=null),t.backPacket||this.swap(t,e)})),!0}createLoop(t,e){t.loop=new V.A((()=>{const i=t.track.getBufferedDuration(e.currentTime+((0,R.A)()-e.currentTimeNTP)/1e3);if(i>e.maxBuffer*(e.playRate>BigInt(100)?Number(e.playRate)/100:1))return t.loop.emptyTask(),void this.checkWaiting(e);if(!t.backPacket)return void(t.packetEnded&&!t.frontPacket?(t.ended=!0,t.loop.stop(),t.enableRawMpeg||($.dJ(t.oformatContext),$.bX(t.oformatContext)),t.bufferQueue.size&&t.track.addBuffer(t.bufferQueue.flush()),t.track.end()):t.loop.emptyTask());let a=t.backPacket;const r=(0,I.Mr)(p.f[17](a+16),a+72,P.i0);if(t.lastDTS!==P.Dh&&r-t.lastDTS>1e3&&($.bX(t.oformatContext),t.startTimestamp-=r-t.lastDTS),t.lastDTS=r,e.enableJitterBuffer&&(p.f[15](e.stats+244)?p.f[15](e.stats+32)/p.f[15](e.stats+244)*1e3:p.f[15](e.stats+232)?p.f[15](e.stats+120)/p.f[15](e.stats+232)*1e3:0)<=p.f[15](e.stats+280)&&this.setPlayRate(e.taskId,1),r*BigInt(100)/e.playRate+t.startTimestamp-BigInt(Math.floor((0,R.A)()))<=0||i<e.minBuffer*(e.playRate>BigInt(100)?Number(e.playRate)/100:1)){t.track.isPaused()&&t.track.enqueue(),g.M[15](a+32,t.oformatContext.streams[0].index),this.writeAVPacket(a,t,!0),t.track.addBuffer(t.bufferQueue.flush());const i=t.oformatContext.streams[0].codecpar.codecType;if(0===i?(g.M[17](e.stats+144,p.f[17](e.stats+144)+BigInt(1)),g.M[17](e.stats+160,p.f[17](e.stats+160)+BigInt(1))):1===i&&(g.M[17](e.stats+56,p.f[17](e.stats+56)+BigInt(1)),g.M[17](e.stats+72,p.f[17](e.stats+72)+BigInt(1))),e.playRate!==e.targetRate&&(t.startTimestamp=BigInt(Math.floor((0,R.A)()))-r*BigInt(100)/e.targetRate,e.playRate=e.targetRate),t.packetEnded&&!t.frontPacket)return t.ended=!0,t.loop.stop(),t.enableRawMpeg||($.dJ(t.oformatContext),$.bX(t.oformatContext)),t.bufferQueue.size&&t.track.addBuffer(t.bufferQueue.flush()),void t.track.end();this.swap(t,e)}else t.loop.emptyTask()}),0,0)}async startMux(t,e,i=BigInt(0)){let a,r=P.Dh,s=P.Dh,n=BigInt(0),o=e.cacheDuration;const c=t.oformatContext.streams[0].timeBase;for(t.backPacket>0&&(r=p.f[17](t.backPacket+16),s=p.f[17](t.backPacket+8),i>s&&(o+=i-(0,I.k)(r,c,P.i0)),g.M[15](t.backPacket+32,t.oformatContext.streams[0].index),this.writeAVPacket(t.backPacket,t),e.avpacketPool.release(t.backPacket),t.backPacket=0);r===P.Dh||(0,I.k)(n-r,c,P.i0)<o;){if(a=await this.pullAVPacket(t,e),a<0){t.packetEnded=!0;break}n=p.f[17](a+16),r===P.Dh&&(r=n,s=p.f[17](a+8)),p.f[17](a+8)<s&&(s=p.f[17](a+8)),g.M[15](a+32,t.oformatContext.streams[0].index),this.writeAVPacket(a,t),e.avpacketPool.release(a)}s!==P.Dh&&t.startPTS<=BigInt(0)&&(t.startPTS=s),t.pullQueue.diff=BigInt(0),e.currentTimeNTP=(0,R.A)(),e.currentTime=0,t.startTimestamp=BigInt(Math.floor((0,R.A)()))-(0,I.k)(n,c,P.i0)*BigInt(100)/e.playRate}resetResource(t,e){t.bufferQueue.flush(),t.oformatContext.oformat.destroy(t.oformatContext);const i=new K.A({fragmentMode:1,fragment:!0,fastOpen:!0,mp4Mode:0,defaultBaseIsMoof:!0,reverseSpsInAvcc:!0,hasTfra:!1});t.oformatContext.oformat=i;const a=new X.A;a.onQuotaExceededError=()=>{t.startTimestamp-=BigInt(100)},a.onEnded=()=>{e.audio&&!e.audio.ended||e.video&&!e.video.ended||(e.mediaSource.endOfStream(),Q.pq(`muxer ended, taskId: ${e.taskId}`,J,994))},t.track=a,t.packetEnded=!1,t.ended=!1,t.startTimestamp=BigInt(0),t.frontBuffered=!1,t.seekSync=null,t.loop&&(t.loop.destroy(),t.loop=null),t.frontPacket&&(e.avpacketPool.release(t.frontPacket),t.frontPacket=0),t.backPacket&&(e.avpacketPool.release(t.backPacket),t.backPacket=0),t.pullQueue.ended=!1,t.pullQueue.index=0,t.pullQueue.frameCount=P.Dh,t.pullQueue.lastPTS=BigInt(0),t.pullQueue.lastDTS=BigInt(0),t.pullQueue.diff=BigInt(0),t.lastDTS=P.Dh}async addStream(t,e,i,a,s,n,o){const c=this.tasks.get(t);if(c){const d=(0,b.Gy)(168);(0,M.A)(i)?(0,y.Yi)(d,i):(0,U.T8)(i,d);const u=new O.A(1048576),f=(0,Y.fG)(),h=new K.A({fragmentMode:1,fragment:!0,fastOpen:!0,mp4Mode:0,defaultBaseIsMoof:!0,reverseSpsInAvcc:!0,hasTfra:!1}),m=new W.A;u.onFlush=t=>(m.write(r()(t).call(t)),0),u.onSeek=t=>m.seek(t)?0:w.lh;const k=f.createStream();(0,y.Yi)(k.codecpar[l.o9],d),k.metadata=s,86017===p.f[15](d+4)&&(k.codecpar.codecTag=(0,H.A)(".mp3"));const v=1===p.f[15](d)&&p.f[15](d+144)&&!c.isLive&&(0,I.lb)(a)>(0,I.lb)({num:1,den:p.f[15](d+136)});v?(k.timeBase.den=p.f[15](d+136),k.timeBase.num=1):(k.timeBase.den=a.den,k.timeBase.num=a.num),f.oformat=h,f.ioWriter=u;const S=new X.A,A={type:"audio",codecpar:d,ioWriter:u,oformatContext:f,oformat:h,track:S,bufferQueue:m,streamIndex:e,pullIPC:new L.Ay(o),loop:null,frontPacket:0,backPacket:0,frontBuffered:!1,startTimestamp:BigInt(0),packetEnded:!1,ended:!1,seekSync:null,startPTS:n,lastDTS:P.Dh,pullQueue:{queue:[],index:0,frameCount:P.Dh,diff:BigInt(0),lastPTS:BigInt(0),lastDTS:BigInt(0),ended:!1,useSampleRateTimeBase:v},enableRawMpeg:86017===p.f[15](d+4)&&!z.A.firefox,timestampOffsetUpdated:!1,ignoreEncryption:!1};S.onQuotaExceededError=()=>{A.startTimestamp-=BigInt(100)},S.onEnded=()=>{c.audio&&!c.audio.ended||c.video&&!c.video.ended||(c.mediaSource.endOfStream(),Q.pq(`muxer ended, taskId: ${c.taskId}`,J,1142))},1===p.f[15](d)?(c.audio=A,g.M[15](c.stats+4,p.f[15](d+136)),g.M[15](c.stats,p.f[15](d+116))):0===p.f[15](d)&&(A.type="video",c.video=A,g.M[15](c.stats+84,p.f[15](d+56)),g.M[15](c.stats+88,p.f[15](d+60)),p.f[15](c.stats+84)*p.f[15](c.stats+88)>8294400&&(z.A.safari||E.A.ios)&&(c.cacheDuration=N.T9(BigInt(3e3),c.cacheDuration))),Q.Yz(`add stream ${e}, taskId: ${t}`,J,1162)}else Q.h2("task not found",J,1165)}async reAddStream(t,e,i,a,r,s){const o=this.tasks.get(t);if(o){const u=(0,b.Gy)(168);(0,M.A)(i)?(0,y.Yi)(u,i):(0,U.T8)(i,u);const f=1===p.f[15](u)?o.audio:o.video;if(f){f.bufferQueue.flush(),await new(n())((t=>{f.track.removeAllBuffer((()=>{t()}))})),f.track.reset();const t=new K.A({fragmentMode:1,fragment:!0,fastOpen:!0,mp4Mode:0,defaultBaseIsMoof:!0,reverseSpsInAvcc:!0,hasTfra:!1});f.oformatContext.oformat=t,f.codecpar&&(0,y.dn)(f.codecpar),f.codecpar=u,f.streamIndex=e,f.startPTS=s;const i=f.oformatContext.streams[0];(0,y.Yi)(i.codecpar[l.o9],u),i.metadata=r,86017===p.f[15](u+4)&&(i.codecpar.codecTag=(0,H.A)(".mp3"));const h=1===p.f[15](u)&&p.f[15](u+144)&&!o.isLive&&(0,I.lb)(a)>(0,I.lb)({num:1,den:p.f[15](u+136)});h?(i.timeBase.den=p.f[15](u+136),i.timeBase.num=1):(i.timeBase.den=a.den,i.timeBase.num=a.num),f.enableRawMpeg=86017===p.f[15](u+4)&&!z.A.firefox,f.timestampOffsetUpdated=!1,f.pullQueue.useSampleRateTimeBase=h;try{f.track.changeMimeType(this.getMimeType(i.codecpar[l.o9]),f.enableRawMpeg?"sequence":"segments")}catch(t){var d;if(!z.A.firefox||c()(d=t.message).call(d,"An attempt was made to use an object that is not")<0)throw t}f.enableRawMpeg||($.ho(f.oformatContext),$.bx(f.oformatContext))}else(0,y.dn)(u);Q.Yz(`readd stream ${e}, taskId: ${t}`,J,1268)}else Q.h2("task not found",J,1271)}async pause(t){const e=this.tasks.get(t);var i,a,r,s;e?(null!==(i=e.audio)&&void 0!==i&&i.loop||null!==(a=e.video)&&void 0!==a&&a.loop||Q.h2("task has not played",J,1279),e.pausing=!0,e.pauseTimestamp=(0,R.A)(),null===(r=e.audio)||void 0===r||r.loop.stop(),null===(s=e.video)||void 0===s||s.loop.stop(),e.fakePlayTimer&&e.fakePlayTimer.stop(),Q.Yz(`pause taskId: ${t}`,J,1289)):Q.h2("task not found",J,1292)}async unpause(t){const e=this.tasks.get(t);var i,a;e?(null!==(i=e.audio)&&void 0!==i&&i.loop||null!==(a=e.video)&&void 0!==a&&a.loop||Q.h2("task has not played",J,1300),e.pausing=!1,e.seeking||(e.audio&&(e.audio.startTimestamp+=BigInt(Math.floor((0,R.A)()-e.pauseTimestamp)),e.audio.loop.start()),e.video&&(e.video.startTimestamp+=BigInt(Math.floor((0,R.A)()-e.pauseTimestamp)),e.video.loop.start())),e.fakePlayTimer&&e.fakePlayTimer.start(),Q.Yz(`unpause taskId: ${t}`,J,1318)):Q.h2("task not found",J,1321)}async beforeSeek(t){const e=this.tasks.get(t);if(e){var i,a;const o=[];var r,s;if(e.audio&&(e.audio.ended||e.audio.frontBuffered||o.push(new(n())((t=>{e.audio.seekSync=t})))),e.video&&(e.video.ended||e.video.frontBuffered||o.push(new(n())((t=>{e.video.seekSync=t})))),await n().all(o),e.seeking=!0,null===(i=e.audio)||void 0===i||i.loop.stop(),null===(a=e.video)||void 0===a||a.loop.stop(),e.audio)e.audio.enableRawMpeg||$.bX(e.audio.oformatContext),e.audio.bufferQueue.flush(),(z.A.safari||E.A.ios)&&await new(n())((t=>{e.audio.track.removeAllBuffer((()=>{t()}))})),e.audio.track.reset(),e.audio.packetEnded=!1,e.audio.timestampOffsetUpdated=!1,e.audio.backPacket&&(e.avpacketPool.release(e.audio.backPacket),e.audio.backPacket=0),e.audio.frontPacket&&(e.avpacketPool.release(e.audio.frontPacket),e.audio.frontPacket=0),e.audio.pullQueue.queue.length&&u()(r=e.audio.pullQueue.queue).call(r,(t=>{e.avpacketPool.release(t)})),e.audio.pullQueue.queue.length=0,e.audio.pullQueue.ended=!1,e.audio.pullQueue.index=0,e.audio.pullQueue.lastPTS=BigInt(0),e.audio.pullQueue.lastDTS=BigInt(0),e.audio.pullQueue.diff=BigInt(0),e.audio.pullQueue.frameCount=P.Dh,e.audio.lastDTS=P.Dh;if(e.video)e.video.enableRawMpeg||$.bX(e.video.oformatContext),e.video.bufferQueue.flush(),(z.A.safari||E.A.ios)&&await new(n())((t=>{e.video.track.removeAllBuffer((()=>{t()}))})),e.video.track.reset(),e.video.packetEnded=!1,e.video.timestampOffsetUpdated=!1,e.video.backPacket&&(e.avpacketPool.release(e.video.backPacket),e.video.backPacket=0),e.video.frontPacket&&(e.avpacketPool.release(e.video.frontPacket),e.video.frontPacket=0),e.video.pullQueue.queue.length&&u()(s=e.video.pullQueue.queue).call(s,(t=>{e.avpacketPool.release(t)})),e.video.pullQueue.queue.length=0,e.video.pullQueue.ended=!1,e.video.pullQueue.index=0,e.video.pullQueue.diff=BigInt(0),e.video.pullQueue.lastPTS=BigInt(0),e.video.pullQueue.lastDTS=BigInt(0),e.video.lastDTS=P.Dh;Q.Yz(`before seek end taskId: ${t}`,J,1432)}}async afterSeek(t,e){const i=this.tasks.get(t);if(i){let a=e,r=e,s=await this.syncToKeyframe(i);i.audio&&i.audio.backPacket>0&&((!s||e<BigInt(0))&&(a=(0,I.Mr)(p.f[17](i.audio.backPacket+8),i.audio.backPacket+72,P.i0)),g.M[15](i.audio.backPacket+32,i.audio.oformatContext.streams[0].index),this.writeAVPacket(i.audio.backPacket,i.audio),i.avpacketPool.release(i.audio.backPacket),i.audio.backPacket=0),i.video&&i.video.backPacket>0&&((!s||e<BigInt(0))&&(r=(0,I.Mr)(p.f[17](i.video.backPacket+8),i.video.backPacket+72,P.i0)),g.M[15](i.video.backPacket+32,i.video.oformatContext.streams[0].index),this.writeAVPacket(i.video.backPacket,i.video),i.avpacketPool.release(i.video.backPacket),i.video.backPacket=0);const o=N.T9(a,r);for(;;){if(i.audio&&!i.audio.packetEnded){if(i.audio.backPacket=await this.pullAVPacket(i.audio,i),i.audio.backPacket<0&&(i.audio.packetEnded=!0,i.audio.backPacket=0,!i.video||i.video.packetEnded))break;if(a<BigInt(0)&&(a=(0,I.Mr)(p.f[17](i.audio.backPacket+8),i.audio.backPacket+72,P.i0)),!((0,I.Mr)(p.f[17](i.audio.backPacket+8),i.audio.backPacket+72,P.i0)<o+i.cacheDuration))break;g.M[15](i.audio.backPacket+32,i.audio.oformatContext.streams[0].index),this.writeAVPacket(i.audio.backPacket,i.audio),i.audio.enableRawMpeg||$.bX(i.audio.oformatContext),i.audio.track.addBuffer(i.audio.bufferQueue.flush()),i.avpacketPool.release(i.audio.backPacket),i.audio.backPacket=0}if(i.video&&!i.video.packetEnded){if(i.video.backPacket=await this.pullAVPacket(i.video,i),i.video.backPacket<0&&(i.video.packetEnded=!0,i.video.backPacket=0,!i.audio||i.audio.packetEnded))break;if(!((0,I.Mr)(p.f[17](i.video.backPacket+8),i.video.backPacket+72,P.i0)<o+i.cacheDuration))break;g.M[15](i.video.backPacket+32,i.video.oformatContext.streams[0].index),this.writeAVPacket(i.video.backPacket,i.video),i.video.enableRawMpeg||$.bX(i.video.oformatContext),i.video.track.addBuffer(i.video.bufferQueue.flush()),i.avpacketPool.release(i.video.backPacket),i.video.backPacket=0}}const c=[];i.audio&&(i.audio.enableRawMpeg||$.bX(i.audio.oformatContext),c.push(new(n())((t=>{i.audio.track.addBuffer(i.audio.bufferQueue.flush(),(()=>{t()}))})))),i.video&&(i.video.enableRawMpeg||$.bX(i.video.oformatContext),c.push(new(n())((t=>{i.video.track.addBuffer(i.video.bufferQueue.flush(),(()=>{t()}))})))),await n().all(c),i.audio&&!i.audio.packetEnded&&(i.audio.backPacket<=0&&(i.audio.backPacket=await this.pullAVPacket(i.audio,i),i.audio.backPacket<0&&(i.audio.packetEnded=!0,i.audio.backPacket=0)),i.audio.packetEnded||(i.audio.frontPacket=await this.pullAVPacket(i.audio,i),i.audio.frontPacket<0?(i.audio.frontPacket=0,i.audio.packetEnded=!0,i.audio.frontBuffered=!1):(i.audio.packetEnded=!1,i.audio.frontBuffered=!0),i.audio.startTimestamp=BigInt(Math.floor((0,R.A)()))-(a+i.cacheDuration+(0,I.k)(i.audio.startPTS,i.audio.oformatContext.streams[0].timeBase,P.i0))*BigInt(100)/i.playRate,i.pausing?i.pauseTimestamp=(0,R.A)():i.audio.loop.start())),i.video&&!i.video.packetEnded&&(i.video.backPacket<=0&&(i.video.backPacket=await this.pullAVPacket(i.video,i),i.video.backPacket<0&&(i.video.packetEnded=!0,i.video.backPacket=0)),i.video.packetEnded||(i.video.frontPacket=await this.pullAVPacket(i.video,i),i.video.frontPacket<0?(i.video.packetEnded=!0,i.video.frontBuffered=!1,i.video.frontPacket=0):(i.video.packetEnded=!1,i.video.frontBuffered=!0),i.video.startTimestamp=BigInt(Math.floor((0,R.A)()))-(r+i.cacheDuration+(0,I.k)(i.video.startPTS,i.video.oformatContext.streams[0].timeBase,P.i0))*BigInt(100)/i.playRate,i.pausing?i.pauseTimestamp=(0,R.A)():i.video.loop.start())),await n().all([new(n())((t=>{i.audio?i.audio.track.insertEnqueueCallback(t):t()})),new(n())((t=>{i.video?i.video.track.insertEnqueueCallback(t):t()}))]);let d=0,u=0;i.audio?i.video?(d=Math.max(i.audio.track.getBufferedStart(),i.video.track.getBufferedStart()),u=Math.min(i.audio.track.getBufferedEnd(),i.video.track.getBufferedEnd())):(d=i.audio.track.getBufferedStart(),u=i.audio.track.getBufferedEnd()):i.video&&(d=i.video.track.getBufferedStart(),u=i.video.track.getBufferedEnd());let f=C.yw(o);return f>=d&&f<=u||(f=Math.abs(f-d)>Math.abs(f-u)?u:d),i.currentTimeNTP=(0,R.A)(),i.currentTime=f,i.seeking=!1,Q.Yz(`after seek end, seekTime: ${f} taskId: ${t}`,J,1670),f}return 0}async setPlayRate(t,e){const i=this.tasks.get(t);if(i){if(i.enableJitterBuffer){let t=p.f[15](i.stats+244)?p.f[15](i.stats+32)/p.f[15](i.stats+244)*1e3:p.f[15](i.stats+232)?p.f[15](i.stats+120)/p.f[15](i.stats+232)*1e3:0;t&&t<=p.f[15](i.stats+280)&&(e=1)}i.targetRate=BigInt(Math.floor(Math.floor(100*e))),i.enableJitterBuffer||(i.audio&&i.audio.loop&&i.audio.loop.resetInterval(),i.video&&i.video.loop&&i.video.loop.resetInterval())}}async restart(t){const e=this.tasks.get(t);if(e){e.audio&&this.resetResource(e.audio,e),e.video&&this.resetResource(e.video,e);const t=new((0,j.A)());t.onsourceopen=this.getSourceOpenHandler(e),e.mediaSource=t}}async setCurrentTime(t,e){const i=this.tasks.get(t);i?(i.audio&&i.audio.track.removeBuffer(e),i.video&&p.f[15](i.stats+92)>0&&(i.video.track.setMediaBufferMax(Math.max(i.video.track.getMediaBufferMax(),Math.ceil(p.f[15](i.stats+92)/1e3*1.5),10)),i.video.track.removeBuffer(e)),i.currentTime=e,i.currentTimeNTP=(0,R.A)()):Q.h2("task not found",J,1743)}async checkWaiting(t){let e=-1,i=-1;const a=t.currentTime+((0,R.A)()-t.currentTimeNTP)/1e3;if(t.audio){const i=t.audio.track.getSourceBuffer();i&&2===i.buffered.length&&i.buffered.end(1)-i.buffered.start(1)>=t.maxBuffer&&i.buffered.end(0)<a&&t.currentTime<i.buffered.start(1)&&(e=i.buffered.start(1))}if(t.video){const e=t.video.track.getSourceBuffer();e&&2===e.buffered.length&&e.buffered.end(1)-e.buffered.start(1)>=t.maxBuffer&&e.buffered.end(0)<a&&t.currentTime<e.buffered.start(1)&&(i=e.buffered.start(1))}if(t.audio&&t.video){if(e>0&&i>0){const a=Math.min(e,i);t.currentTime=a,t.controlIPCPort.notify("seek",{time:a})}}else e>0?(t.currentTime=e,t.controlIPCPort.notify("seek",{time:e})):i>0&&(t.currentTime=i,t.controlIPCPort.notify("seek",{time:i}))}async getMediaSource(t){const e=this.tasks.get(t);if(e)return e.mediaSource.handle?(this.getMediaSource.transfer.push(e.mediaSource.handle),e.mediaSource.handle):e.mediaSource;Q.h2("task not found",J,1808)}async isManagedMediaSource(t){const e=this.tasks.get(t);if(e)return"function"==typeof ManagedMediaSource&&e.mediaSource instanceof ManagedMediaSource;Q.h2("task not found",J,1819)}createTask(t,e){const i=new L.Ay(t.controlPort),a=new((0,j.A)()),r={...t,mediaSource:a,audio:null,video:null,playRate:BigInt(100),targetRate:BigInt(100),pauseTimestamp:0,seeking:!1,pausing:!1,controlIPCPort:i,currentTime:0,currentTimeNTP:0,cacheDuration:BigInt(Math.floor(500)),avpacketPool:new x.A((0,h.A)(t.avpacketList,k.A),t.avpacketListMutex),maxBuffer:t.isLive?1:4,minBuffer:t.isLive?.5:2,visibilityHidden:!1,fakePlayTimer:null};return this.tasks.set(t.taskId,r),a.onsourceopen=this.getSourceOpenHandler(r,e),i.on(L.Wo,(e=>{"visibilitychange"===e.method&&this.setVisibilityHidden(t.taskId,e.params.visibilityHidden)})),0}async setVisibilityHidden(t,e){const i=this.tasks.get(t);i&&(i.visibilityHidden=e,e?i.isLive&&i.video&&!i.audio&&(i.fakePlayTimer&&i.fakePlayTimer.destroy(),i.fakePlayTimer=new q.A((()=>{this.setCurrentTime(i.taskId,i.currentTime+((0,R.A)()-i.currentTimeNTP)/1e3)}),0,1e3),i.fakePlayTimer.start()):i.fakePlayTimer&&(i.fakePlayTimer.destroy(),i.fakePlayTimer=null,i.video.track.getBufferedTime()>(i.isLive?2:4)&&(this.setCurrentTime(i.taskId,Math.max(i.video.track.getBufferedEnd()-(i.isLive?1:4),i.video.track.getBufferedStart())),i.controlIPCPort.notify("seek",{time:i.currentTime}))))}async registerTask(t,e=BigInt(0)){return this.tasks.has(t.taskId)?w.lh:this.createTask(t,e)}async unregisterTask(t){const e=this.tasks.get(t);if(e){var i,a;if(e.audio)e.audio.loop&&(await e.audio.oformatContext.destroy(),e.audio.loop.destroy()),e.audio.pullIPC&&e.audio.pullIPC.destroy(),e.audio.pullQueue.queue.length&&(u()(i=e.audio.pullQueue.queue).call(i,(t=>{e.avpacketPool.release(t)})),e.audio.pullQueue.queue.length=0),e.audio.codecpar&&(0,y.dn)(e.audio.codecpar);if(e.video)e.video.loop&&(await e.video.oformatContext.destroy(),e.video.loop.destroy()),e.video.pullIPC&&e.video.pullIPC.destroy(),e.video.pullQueue.queue.length&&(u()(a=e.video.pullQueue.queue).call(a,(t=>{e.avpacketPool.release(t)})),e.video.pullQueue.queue.length=0),e.video.codecpar&&(0,y.dn)(e.video.codecpar);e.controlIPCPort&&e.controlIPCPort.destroy(),this.tasks.delete(t)}}}},67517:(t,e,i)=>{"use strict";i.d(e,{XA:()=>w,bX:()=>b,bx:()=>k,dJ:()=>v,ho:()=>g});var a=i(23339),r=i.n(a),s=i(53508),n=i(3029),o=i(58021),c=i(58650),d=i(46630),u=i(21782),f=i(34492),l=i(9984),p=i(82915);const h="packages/avformat/src/mux.ts",m={zeroStart:!1,nonnegative:!1};function g(t,e={}){const i=f.extend({},m,e);t.ioWriter||p.h2("need ioWriter",h,65),t.oformat||p.h2("need oformat",h,68),t.options=i,t.privateData2={firstPts:new(r()),firstDts:new(r()),dtsPtsDelta:new(r())};let a=t.oformat.getCapabilities();if(a)for(let e=0;e<t.streams.length;e++){if(1024&t.streams[e].disposition)continue;const i=t.streams[e].codecpar.codecId,r=t.streams[e].codecpar.codecType;if(16===t.oformat.type){if(i<65536||i>69683)return p.z3(`format ${(0,o.L_)(t.oformat.type)} not support codecId ${(0,o.eG)(t.streams[e].codecpar.codecType,i)}`,h,90),c.r8}else if(2!==r&&4!==r&&!u.zy(a,i))return p.z3(`format ${(0,o.L_)(t.oformat.type)} not support codecId ${(0,o.eG)(t.streams[e].codecpar.codecType,i)}`,h,98),c.r8}return t.oformat.init(t)}function k(t){return t.oformat.writeHeader(t),0}function w(t,e){const i=t.privateData2;return i.firstDts.has(s.f[15](e+32))||i.firstDts.set(s.f[15](e+32),s.f[17](e+16)===d.Dh?BigInt(0):s.f[17](e+16)),i.firstPts.has(s.f[15](e+32))||(i.firstPts.set(s.f[15](e+32),s.f[17](e+8)===d.Dh?BigInt(0):s.f[17](e+8)),i.dtsPtsDelta.set(s.f[15](e+32),l.jk(i.firstDts.get(s.f[15](e+32)),i.firstPts.get(s.f[15](e+32))))),(t.options.zeroStart||t.options.nonnegative&&(i.firstDts.get(s.f[15](e+32))<0||i.firstPts.get(s.f[15](e+32))<0))&&(n.M[17](e+16,s.f[17](e+16)-i.dtsPtsDelta.get(s.f[15](e+32))),n.M[17](e+8,s.f[17](e+8)-i.dtsPtsDelta.get(s.f[15](e+32)))),t.oformat.writeAVPacket(t,e)}function v(t){return t.oformat.writeTrailer(t),0}function b(t){t.oformat.flush(t)}},71846:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var a=i(75138),r=i(26367);function s(t,e,i){let s;if(i.fragment&&e.sideData[1]?(s=e.sideData[1],delete e.sideData[1]):e.codecpar.extradata&&(s=(0,r.s3)(e.codecpar.extradata,e.codecpar.extradataSize)),!s||s.length<19)t.writeUint32(19),t.writeString("dOps"),t.writeUint8(0),t.writeUint8(e.codecpar.chLayout.nbChannels),t.writeUint16(e.codecpar.initialPadding),t.writeUint32(e.codecpar.sampleRate),t.writeUint16(0),t.writeUint8(0);else{const e=new a.A(s,!1);t.writeUint32(s.length),t.writeString("dOps"),t.writeUint8(0),e.seek(9),t.writeUint8(e.readUint8()),t.writeUint16(e.readUint16()),t.writeUint32(e.readUint32()),t.writeUint16(e.readUint16()),t.writeBuffer(s.subarray(18))}}},75075:(t,e,i)=>{"use strict";i.d(e,{A:()=>d});var a=i(9538),r=i.n(a),s=i(92211),n=i(32094),o=i(46630),c=i(54163);function d(t,e,i){const a=e.privData,d=(0,c.k)((0,n.A)(a),e.timeBase,{den:i.timescale,num:1}),u=e.metadata.creationTime||0,f=e.metadata.modificationTime||0,l=a.layer||0,p=a.alternateGroup||0;let h=e.codecpar.width>0?e.codecpar.width:0,m=e.codecpar.height>0?e.codecpar.height:0;const g=(0,c.lb)(e.codecpar.sampleAspectRatio);0!==g&&g!==1/0&&(h=Math.floor(h*g)),h<o.zg&&(h<<=16),m<o.zg&&(m<<=16);let k=d<BigInt(o.f7)?0:1;k=u<o.f7?0:1,k=f<o.f7?0:1;let w=2;1&r()(a)&&(w|=1),t.writeUint32(1===k?100:92),t.writeString("tkhd"),t.writeUint8(k),t.writeUint24(w),1===k?(t.writeUint64(u),t.writeUint64(f)):(t.writeUint32(Number(u)),t.writeUint32(Number(f))),t.writeUint32(a.trackId),t.writeUint32(0),1===k?t.writeUint64(d):t.writeUint32(Number(d)),t.writeUint32(0),t.writeUint32(0),t.writeInt16(l),t.writeInt16(a.perStreamGrouping?p:e.codecpar.codecType),1===e.codecpar.codecType?t.writeInt16(256):t.writeInt16(0),t.writeInt16(0);const v=e.metadata.matrix;v?(0,s.A)(t,v[0],v[1],v[3],v[4],v[6],v[7]):(0,s.A)(t,1,0,0,1,0,0),t.writeUint32(h),t.writeUint32(m)}},75676:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var a=i(82915);const r="packages/avformat/src/formats/isobmff/writing/ctts.ts";function s(t,e,i){const s=e.privData,n=s.cttsSampleCounts||[],o=s.cttsSampleOffsets||[];n.length!==o.length&&a.R8("ctts sampleCounts's length is not match sampleOffsets's length",r,39);const c=Math.min(n.length,o.length);t.writeUint32(16+8*c),t.writeString("ctts"),t.writeUint8(1),t.writeUint24(0),t.writeUint32(c);for(let e=0;e<c;e++)t.writeUint32(n[e]),t.writeInt32(o[e])}},77102:(t,e,i)=>{"use strict";function a(t,e,i){t.writeUint32(16),t.writeString("pasp"),t.writeUint32(1),t.writeUint32(1)}i.d(e,{A:()=>a})},77489:(t,e,i)=>{"use strict";i(85617);var a=i(72071);t.exports=a.Math.trunc},78489:(t,e,i)=>{"use strict";i.d(e,{A:()=>u});var a=i(50442),r=i.n(a),s=i(18811),n=i.n(s),o=i(17283),c=i(10700),d=i(54163);function u(t,e,i){const a=t.getPos();t.writeUint32(0),t.writeString("chpl"),t.writeUint32(16777216),t.writeUint32(0);const s=i.chapters;t.writeUint8(s.length),r()(s).call(s,(e=>{t.writeUint64((0,d.k)(e.start,e.timeBase,{num:1,den:1e7}));let i=e.metadata.title;if(i&&o.Yj(i)){let e=c.encode(i);e.length>255&&(e=n()(e).call(e,0,255)),t.writeUint8(e.length),t.writeBuffer(e)}else t.writeUint8(0)})),i.boxsPositionInfo.push({pos:a,type:"chpl",size:Number(t.getPos()-a)})}},79943:(t,e,i)=>{"use strict";function a(t,e,i){t.writeUint32(12),t.writeString("nmhd"),t.writeUint32(0)}i.d(e,{A:()=>a})},80014:(t,e,i)=>{"use strict";function a(t,e,i){t.writeUint32(20),t.writeString("btrt"),t.writeUint32(0),t.writeUint32(0),t.writeUint32(0)}i.d(e,{A:()=>a})},82758:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var a=i(32094),r=i(46630),s=i(54163);function n(t,e,i){const n=e.privData;let o=(0,s.k)((0,a.A)(n),e.timeBase,{den:i.timescale,num:1}),c=n.startCT;const d=(0,s.k)(n.startDts+BigInt(Math.floor(c)),e.timeBase,{den:i.timescale,num:1});let u=o<r.go?0:1;u|=d<r.go?0:1;const f=1+(d>0?1:0),l=24+f*(1===u?20:12);t.writeUint32(l),t.writeString("edts"),t.writeUint32(l-8),t.writeString("elst"),t.writeUint8(u),t.writeUint24(0),t.writeUint32(f),d>0?(1===u?(t.writeUint64(d),t.writeInt64(r.Dh)):(t.writeUint32(Number(d)),t.writeInt32(-1)),t.writeUint32(65536)):(c=-Math.min(Number(n.startDts),0),o+=d),i.fragment&&(o=BigInt(0)),1===u?(t.writeUint64(o),t.writeInt64(BigInt(Math.floor(c)))):(t.writeUint32(Number(o)),t.writeInt32(c)),t.writeUint32(65536)}},82846:(t,e,i)=>{"use strict";i.d(e,{A:()=>r});var a=i(26367);function r(t,e,i){var r;t.writeUint32(12+(null!==(r=e.codecpar.extradataSize)&&void 0!==r?r:0)),t.writeString("vpcC"),t.writeUint8(1),t.writeUint24(0),i.fragment&&e.sideData[1]?(t.writeBuffer(e.sideData[1]),delete e.sideData[1]):e.codecpar.extradata&&t.writeBuffer((0,a.s3)(e.codecpar.extradata,e.codecpar.extradataSize))}},83103:(t,e,i)=>{"use strict";function a(t,e,i){const a=e.privData.stssSampleNumbers;t.writeUint32(16+4*a.length),t.writeString("stss"),t.writeUint8(0),t.writeUint24(0),t.writeUint32(a.length);for(let e=0;e<a.length;e++)t.writeUint32(a[e])}i.d(e,{A:()=>a})},84770:(t,e,i)=>{"use strict";function a(t,e,i){const a=e.privData.chunkOffsets||[];t.writeUint32(16+8*a.length),t.writeString("co64"),t.writeUint8(0),t.writeUint24(0),t.writeUint32(a.length);for(let e=0;e<a.length;e++)t.writeUint64(a[e])}i.d(e,{A:()=>a})},85617:(t,e,i)=>{"use strict";i(89838)({target:"Math",stat:!0},{trunc:i(40317)})},87550:(t,e,i)=>{"use strict";function a(t,e,i){const a=e.sideData[28];if(a)t.writeUint32(12+a.length),t.writeString("colr"),t.writeString("prof"),t.writeBuffer(a);else{const i=2===e.codecpar.colorRange;t.writeUint32(19),t.writeString("colr"),t.writeString("nclx"),t.writeUint16(e.codecpar.colorPrimaries),t.writeUint16(e.codecpar.colorTrc),t.writeUint16(e.codecpar.colorSpace),t.writeUint8(i?128:0)}}i.d(e,{A:()=>a})},90600:(t,e,i)=>{"use strict";i.d(e,{A:()=>M});var a=i(66380),r=i(75676),s=i(83103),n=i(48920),o=i(61263),c=i(40675),d=i(84770),u=i(50539),f=i(1965),l=i(75075),p=i(30172),h=i(43702),m=i(57247),g=i(82758),k=i(33142),w=i(79943),v=i(45805),b=i(39415),U=i(22509),I=i(32125),P=i(52728),y=i(39108),S=i(90703),A=i(46606),B=i(13361),x=i(25638),T=i(55013),D=i(92803),C=i(78489);const M={stts:a.A,ctts:r.A,stss:s.A,stsz:n.A,stsc:o.A,stco:c.A,co64:d.A,mdhd:u.A,mvhd:f.A,tkhd:l.A,hdlr:p.A,stsd:h.A,vmhd:m.A,edts:g.A,smhd:k.A,nmhd:w.A,sthd:v.A,dref:b.A,trex:U.A,mfhd:I.A,tfhd:P.A,tfdt:y.A,trun:S.A,minf_hdlr:A.A,saio:x.A,saiz:B.A,senc:T.A,meta:D.A,chpl:C.A}},90703:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var a=i(41450),r=i.n(a);function s(t,e,i){var a;const s=e.privData,n=r()(a=i.currentFragment.tracks).call(a,(t=>t.trackId===s.trackId)),o=n.firstSampleFlags||0,c=n.dataOffset||0,d=n.sampleDurations,u=n.sampleSizes,f=n.sampleFlags,l=n.sampleCompositionTimeOffset,p=n.sampleCount,h=d.length>0,m=u.length>0,g=f.length>0,k=l.length>0,w=0!==o;let v=1;w&&(v|=4),h&&(v|=256),m&&(v|=512),g&&(v|=1024),k&&(v|=2048);const b=t.getPos();t.writeUint32(0),t.writeString("trun"),t.writeUint8(1),t.writeUint24(v),t.writeUint32(p),n.dataOffsetPos=t.getPos(),t.writeInt32(c),w&&t.writeUint32(o);for(let e=0;e<p;e++)h&&t.writeUint32(d[e]||0),m&&t.writeUint32(u[e]||0),g&&t.writeUint32(f[e]||0),k&&t.writeInt32(l[e]||0);i.boxsPositionInfo.push({pos:b,type:"trun",size:Number(t.getPos()-b)})}},92211:(t,e,i)=>{"use strict";function a(t,e,i,a,r,s,n){t.writeInt32(Math.floor(65536*e)),t.writeInt32(Math.floor(65536*i)),t.writeInt32(0),t.writeInt32(Math.floor(65536*a)),t.writeInt32(Math.floor(65536*r)),t.writeInt32(0),t.writeInt32(Math.floor(65536*s)),t.writeInt32(Math.floor(65536*n)),t.writeInt32(1073741824)}i.d(e,{A:()=>a})},92803:(t,e,i)=>{"use strict";i.d(e,{A:()=>g});var a=i(5463),r=i.n(a),s=i(3579),n=i.n(s),o=i(50442),c=i.n(o),d=i(20638),u=i.n(d),f=i(36297),l=i(33236),p=i(17283),h=i(34492),m=i(10700);function g(t,e,i){const a=t.getPos();t.writeUint32(0),t.writeString("meta"),t.writeUint32(0),t.writeUint32(33),t.writeString("hdlr"),t.writeUint32(0),t.writeString("dhlr"),t.writeString(i.useMetadataTags?"mdta":"mdir"),t.writeUint32(0),t.writeUint32(0),t.writeUint32(0),t.writeUint8(0);let s=[],o=[];const d=r()(h).call(h,f.c);function g(t){return i.useMetadataTags?(s.push(t),s.length):d[t]||4===t.length?(0,l.A)(d[t]||t):void 0}if(o.push({key:g("encoder"),value:"libmedia-v1.0.1-7-g938a591e"}),i.covr&&o.push({key:g("covr"),value:i.covr.data,type:i.covr.type}),i.metadata&&h.each(i.metadata,((t,e)=>{if((p.Yj(t)||p.ai(t)||t instanceof Uint8Array)&&"encoder"!==e.toLocaleLowerCase()){let i=g(e);i&&o.push({key:i,value:t})}})),s.length&&(t.writeUint32(16+n()(s).call(s,((t,e)=>t+(8+e.length)),0)),t.writeString("keys"),t.writeUint32(0),t.writeUint32(s.length),c()(s).call(s,(e=>{t.writeUint32(e.length+8),t.writeString("mdta"),t.writeString(e)}))),o.length){const e=t.getPos();t.writeUint32(0),t.writeString("ilst"),c()(o).call(o,(e=>{let i,a=0,r=0;if(p.ai(e.value))a=u()(e.value)===e.value?e.value<0?21:22:23,r=4;else if(e.value instanceof Uint8Array){var s;a=null!==(s=e.type)&&void 0!==s?s:0,r=e.value.length}else{if(!p.Yj(e.value))return;a=1,i=m.encode(e.value),r=i.length}t.writeUint32(24+r),t.writeUint32(e.key),t.writeUint32(16+r),t.writeString("data"),t.writeUint32(a),t.writeUint32(0),0===a||e.value instanceof Uint8Array?t.writeBuffer(e.value):1===a?t.writeBuffer(i):21===a?t.writeInt32(e.value):22===a?t.writeUint32(e.value):23===a&&t.writeFloat(e.value)})),i.boxsPositionInfo.push({pos:e,type:"ilst",size:Number(t.getPos()-e)})}i.boxsPositionInfo.push({pos:a,type:"meta",size:Number(t.getPos()-a)})}}}]);
|
package/dist/umd/243.avplayer.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunkAVPlayer=self.webpackChunkAVPlayer||[]).push([[243],{3243:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>U});var s=i(82563),n=i(23339),a=i.n(n),r=i(63856),o=i.n(r),d=i(9105),l=i.n(d),u=i(42399),c=i.n(u),m=i(50442),h=i.n(m),g=i(92983),p=i.n(g),f=i(77385),v=i.n(f),S=i(22887),y=i.n(S),L=i(41450),R=i.n(L),b=i(13135),x=i(58650),P=i(34492),A=i(82915),w=i(79579),I=i(84214),T=i(55101),D=i(9075);const B="packages/avnetwork/src/ioLoader/DashIOLoader.ts";class U extends D.A{constructor(...e){super(...e),(0,s.A)(this,"info",void 0),(0,s.A)(this,"mediaPlayList",void 0),(0,s.A)(this,"fetchMediaPlayListPromise",void 0),(0,s.A)(this,"minBuffer",void 0),(0,s.A)(this,"audioResource",void 0),(0,s.A)(this,"videoResource",void 0),(0,s.A)(this,"subtitleResource",void 0),(0,s.A)(this,"aborted",void 0),(0,s.A)(this,"signal",void 0)}createResource(e){return{type:e,fetchedMap:new(a()),fetchedHistoryListMax:100,fetchedHistoryList:[],loader:null,segmentIndex:0,currentUri:"",selectedIndex:0,segments:[],initSegmentPadding:"",initedSegment:"",sleep:null,lastPendingSegmentFetchTs:0,lastPendingSegmentDuration:0}}addHistory(e,t,i){e.fetchedMap.clear(),e.fetchedHistoryList.length=0;for(let s=0;s<i;s++)e.fetchedMap.set(t[s].url,!0),e.fetchedHistoryList.push(t[s].url);for(;e.fetchedHistoryList.length>=e.fetchedHistoryListMax;)e.fetchedMap.delete(e.fetchedHistoryList.shift())}async fetchMediaPlayList(e){var t,i,s;if(!e){if(this.fetchMediaPlayListPromise)return;this.fetchMediaPlayListPromise=new(o())((t=>{e=t}))}const n={method:"GET",headers:{},mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};null!==(t=this.info.httpOptions)&&void 0!==t&&t.headers&&P.each(this.info.httpOptions.headers,((e,t)=>{n.headers[t]=e})),null!==(i=this.info.httpOptions)&&void 0!==i&&i.credentials&&(n.credentials=this.info.httpOptions.credentials),null!==(s=this.info.httpOptions)&&void 0!==s&&s.referrerPolicy&&(n.referrerPolicy=this.info.httpOptions.referrerPolicy);try{var a;"function"==typeof AbortController&&(this.signal=new AbortController);const t=await fetch(this.info.url,{...n,signal:null===(a=this.signal)||void 0===a?void 0:a.signal});this.signal=null;const i=await t.text();this.mediaPlayList=(0,I.A)(i,this.info.url),this.minBuffer=this.mediaPlayList.minBufferTime,"vod"===this.mediaPlayList.type?this.options.isLive=!1:this.options.isLive=!0;const s=(e,t,i)=>{let s=0,n=0;for(let e=t.length-2;e>=0;e--)if(!0!==t[e].pending&&(n+=t[e].segmentDuration,n>=i)){s=e;break}e.lastPendingSegmentFetchTs=this.mediaPlayList.maxSegmentDuration,e.lastPendingSegmentDuration=this.mediaPlayList.maxSegmentDuration,e.fetchedHistoryListMax=Math.max(e.fetchedHistoryListMax,t.length+1),this.addHistory(e,t,s)};if(this.mediaPlayList.mediaList.audio.length){if(this.options.preferAudioCodec||this.options.preferAudioLang){var r,d;let e=!1,t=!1,i=l()(r=this.mediaPlayList.mediaList.audio).call(r,(e=>{var t;return e.codecs&&c()(t=e.codecs).call(t,this.options.preferAudioCodec)>=0}));h()(d=this.mediaPlayList.mediaList.audio).call(d,((s,n)=>{var a,r;this.options.preferAudioCodec&&i&&s.codecs&&-1===c()(a=s.codecs).call(a,this.options.preferAudioCodec)||(e||(this.audioResource.selectedIndex=n,e=!0),s.lang&&this.options.preferAudioLang&&c()(r=s.lang).call(r,this.options.preferAudioLang)>=0&&!t&&(this.audioResource.selectedIndex=n,s.lang===this.options.preferAudioLang&&(t=!0)))}))}const e=this.mediaPlayList.mediaList.audio[this.audioResource.selectedIndex];var u,m,g;e.file?this.audioResource.segments=[{url:e.file}]:this.options.isLive&&this.audioResource.initedSegment===e.initSegment?(this.audioResource.segments=p()(u=e.mediaSegments).call(u,(e=>({url:e.url,pending:e.pending,duration:e.segmentDuration}))),this.audioResource.lastPendingSegmentFetchTs=this.mediaPlayList.timestamp,this.audioResource.lastPendingSegmentDuration=this.mediaPlayList.maxSegmentDuration):(this.options.isLive&&s(this.audioResource,e.mediaSegments,this.minBuffer),this.audioResource.segments=v()(m=[{url:e.initSegment}]).call(m,p()(g=e.mediaSegments).call(g,(e=>({url:e.url,pending:e.pending,duration:e.segmentDuration})))),this.audioResource.initedSegment=e.initSegment)}if(this.mediaPlayList.mediaList.video.length){if(this.options.preferResolution||this.options.preferVideoCodec){var f,S;let e=1,t=1;if(this.options.preferResolution){const i=this.options.preferResolution.split("*");e=+i[0]||1,t=+i[1]||1}let i=!1,s=1/0,n=l()(f=this.mediaPlayList.mediaList.video).call(f,(e=>{var t;return e.codecs&&c()(t=e.codecs).call(t,this.options.preferVideoCodec)>=0}));h()(S=this.mediaPlayList.mediaList.video).call(S,((a,r)=>{var o;if(!(this.options.preferVideoCodec&&n&&a.codecs&&-1===c()(o=a.codecs).call(o,this.options.preferVideoCodec))&&(i||(this.videoResource.selectedIndex=r,i=!0),a.width&&a.height&&this.options.preferResolution)){const i=1===e?1:a.width,n=1===t?1:a.height;Math.abs(i*n-e*t)<s&&(s=Math.abs(i*n-e*t),this.videoResource.selectedIndex=r)}}))}const e=this.mediaPlayList.mediaList.video[this.videoResource.selectedIndex];var y,L,R;e.file?this.videoResource.segments=[{url:e.file}]:this.options.isLive&&this.videoResource.initedSegment===e.initSegment?(this.videoResource.segments=p()(y=e.mediaSegments).call(y,(e=>({url:e.url,pending:e.pending,duration:e.segmentDuration}))),this.videoResource.lastPendingSegmentFetchTs=this.mediaPlayList.maxSegmentDuration,this.videoResource.lastPendingSegmentDuration=this.mediaPlayList.maxSegmentDuration):(this.options.isLive&&s(this.videoResource,e.mediaSegments,this.minBuffer),this.videoResource.segments=v()(L=[{url:e.initSegment}]).call(L,p()(R=e.mediaSegments).call(R,(e=>({url:e.url,pending:e.pending,duration:e.segmentDuration})))),this.videoResource.initedSegment=e.initSegment)}if(this.mediaPlayList.mediaList.subtitle.length){if(this.options.preferSubtitleCodec||this.options.preferSubtitleLang){var x,w;let e=!1,t=!1,i=l()(x=this.mediaPlayList.mediaList.subtitle).call(x,(e=>{var t;return e.codecs&&c()(t=e.codecs).call(t,this.options.preferSubtitleCodec)>=0}));h()(w=this.mediaPlayList.mediaList.subtitle).call(w,((s,n)=>{var a,r;this.options.preferSubtitleCodec&&i&&s.codecs&&-1===c()(a=s.codecs).call(a,this.options.preferSubtitleCodec)||(e||(this.subtitleResource.selectedIndex=n,e=!0),s.lang&&this.options.preferSubtitleLang&&c()(r=s.lang).call(r,this.options.preferSubtitleLang)>=0&&!t&&(this.subtitleResource.selectedIndex=n,s.lang===this.options.preferSubtitleLang&&(t=!0)))}))}const e=this.mediaPlayList.mediaList.subtitle[this.subtitleResource.selectedIndex];var T,D,U;e.file?this.subtitleResource.segments=[{url:e.file}]:this.options.isLive&&this.subtitleResource.initedSegment===e.initSegment?(this.subtitleResource.segments=p()(T=e.mediaSegments).call(T,(e=>({url:e.url,pending:e.pending,duration:e.segmentDuration}))),this.subtitleResource.lastPendingSegmentFetchTs=this.mediaPlayList.maxSegmentDuration,this.subtitleResource.lastPendingSegmentDuration=this.mediaPlayList.maxSegmentDuration):(this.options.isLive&&s(this.subtitleResource,e.mediaSegments,this.minBuffer),this.subtitleResource.segments=v()(D=[{url:e.initSegment}]).call(D,p()(U=e.mediaSegments).call(U,(e=>({url:e.url,pending:e.pending,duration:e.segmentDuration})))),this.subtitleResource.initedSegment=e.initSegment)}return e(),this.fetchMediaPlayListPromise=null,this.status=2,this.retryCount=0,this.mediaPlayList}catch(t){if(this.aborted)return this.status=3,void e();if(this.retryCount<this.options.retryCount)return this.retryCount++,A.z3(`failed fetch mpd file ${t}, retry(${this.retryCount}/3)`,B,397),await new b.A(2===this.status?this.options.retryInterval:5),this.fetchMediaPlayList(e);this.status=3,e(),A.h2(`DashLoader: exception, fetch slice error, error: ${t.message}`,B,405)}}async open(e){return 2===this.status?0:0!==this.status?x.lh:(this.info=e,this.videoResource=this.createResource(0),this.audioResource=this.createResource(1),this.subtitleResource=this.createResource(3),this.status=1,this.retryCount=0,this.aborted=!1,await this.fetchMediaPlayList(),0)}async readResource(e,t){let i=0;if(t.loader){if(i=await t.loader.read(e),-1048576!==i||this.aborted)return i;if(this.options.isLive)t.fetchedMap.set(t.currentUri,!0),t.fetchedHistoryList.length===t.fetchedHistoryListMax&&t.fetchedMap.delete(t.fetchedHistoryList.shift()),t.fetchedHistoryList.push(t.currentUri);else if(t.segmentIndex++,t.segmentIndex>=t.segments.length)return-1048576;t.loader=null}if(this.options.isLive){var s;const i=y()(s=t.segments).call(s,(e=>!t.fetchedMap.get(e.url)));if(!i.length){if(this.mediaPlayList.isEnd)return-1048576;const i=(this.mediaPlayList.duration||this.mediaPlayList.minimumUpdatePeriod)-((0,w.A)()-this.mediaPlayList.timestamp)/1e3;if(i>0&&(t.sleep=new b.A(i),await t.sleep,t.sleep=null,this.aborted))return-1048576;if(this.fetchMediaPlayListPromise){if(await this.fetchMediaPlayListPromise,3===this.status||this.aborted)return-1048576}else if(await this.fetchMediaPlayList(),this.aborted)return-1048576;return this.readResource(e,t)}if(t.currentUri=i[0].url,this.options.isLive&&i[0].pending){if(t.lastPendingSegmentFetchTs){const e=t.lastPendingSegmentDuration-((0,w.A)()-t.lastPendingSegmentFetchTs)/1e3;if(e>0&&(t.sleep=new b.A(e),await t.sleep,t.sleep=null,this.aborted))return-1048576}t.lastPendingSegmentFetchTs=(0,w.A)(),t.lastPendingSegmentDuration=i[0].duration||this.mediaPlayList.maxSegmentDuration}return t.loader=new T.A(P.extend({},this.options,{disableSegment:!0,loop:!1,enableBandwidthReader:0===t.type})),await t.loader.open(P.extend({},this.info,{url:t.currentUri}),{from:0,to:-1}),t.loader.read(e)}return t.loader=new T.A(P.extend({},this.options,{disableSegment:!0,loop:!1,enableBandwidthReader:0===t.type})),t.initSegmentPadding?(await t.loader.open(P.extend({},this.info,{url:t.initSegmentPadding}),{from:0,to:-1}),t.initSegmentPadding=null,t.segmentIndex--):await t.loader.open(P.extend({},this.info,{url:t.segments[t.segmentIndex].url}),{from:0,to:-1}),t.loader.read(e)}async read(e,t){return 1===t.mediaType?this.readResource(e,this.audioResource):0===t.mediaType?this.readResource(e,this.videoResource):3===t.mediaType?this.readResource(e,this.subtitleResource):x.UY}async seekResource(e,t){let i="";t.loader&&(i=t.loader.getUrl(),await t.loader.abort(),t.loader=null);let s=Number(BigInt.asIntN(32,e));if(t.segments){let e=0;const n=1===t.type?this.mediaPlayList.mediaList.audio:0===t.type?this.mediaPlayList.mediaList.video:this.mediaPlayList.mediaList.subtitle,a=n[t.selectedIndex].mediaSegments;if(null!=a&&a.length){e=-1;for(let t=0;t<a.length;t++)if(s>=1e3*a[t].start&&s<1e3*a[t].end){e=t;break}-1===e&&(e=a.length-1)}t.segmentIndex=e+(n[t.selectedIndex].initSegment?1:0);let r="";0===t.type?r=this.mediaPlayList.mediaList.video[t.selectedIndex].initSegment:1===t.type?r=this.mediaPlayList.mediaList.audio[t.selectedIndex].initSegment:3===t.type&&(r=this.mediaPlayList.mediaList.subtitle[t.selectedIndex].initSegment),r&&r===i&&(t.initSegmentPadding=r)}}async seek(e,t){return 1===t.mediaType&&this.audioResource.loader&&await this.seekResource(e,this.audioResource),0===t.mediaType&&this.videoResource.loader&&await this.seekResource(e,this.videoResource),3===t.mediaType&&this.subtitleResource.loader&&await this.seekResource(e,this.subtitleResource),4===this.status&&(this.status=2),this.aborted=!1,0}async size(){return BigInt(0)}abortSleep(){this.aborted=!0,this.videoResource.loader&&this.videoResource.loader.abortSleep(),this.videoResource.sleep&&(this.videoResource.sleep.stop(),this.videoResource.sleep=null),this.audioResource.loader&&this.audioResource.loader.abortSleep(),this.audioResource.sleep&&(this.audioResource.sleep.stop(),this.audioResource.sleep=null),this.subtitleResource.loader&&this.subtitleResource.loader.abortSleep(),this.subtitleResource.sleep&&(this.subtitleResource.sleep.stop(),this.subtitleResource.sleep=null)}async abort(){this.abortSleep(),this.signal&&this.signal.abort(),this.videoResource.loader&&(await this.videoResource.loader.abort(),this.videoResource.loader=null),this.audioResource.loader&&(await this.audioResource.loader.abort(),this.audioResource.loader=null),this.subtitleResource.loader&&(await this.subtitleResource.loader.abort(),this.subtitleResource.loader=null)}async stop(){await this.abort(),this.status=0}getDuration(){return this.mediaPlayList.duration}hasVideo(){var e;return(null===(e=this.mediaPlayList)||void 0===e?void 0:e.mediaList.video.length)>0}hasAudio(){var e;return(null===(e=this.mediaPlayList)||void 0===e?void 0:e.mediaList.audio.length)>0}hasSubtitle(){var e;return(null===(e=this.mediaPlayList)||void 0===e?void 0:e.mediaList.subtitle.length)>0}getVideoList(){var e;return this.hasVideo()?{list:p()(e=this.mediaPlayList.mediaList.video).call(e,(e=>({width:e.width,height:e.height,frameRate:e.frameRate,codec:e.codecs,bandwidth:e.bandwidth}))),selectedIndex:this.videoResource.selectedIndex}:{list:[],selectedIndex:0}}getAudioList(){var e;return this.hasAudio()?{list:p()(e=this.mediaPlayList.mediaList.audio).call(e,(e=>({lang:e.lang,codec:e.codecs,bandwidth:e.bandwidth}))),selectedIndex:this.audioResource.selectedIndex}:{list:[],selectedIndex:0}}getSubtitleList(){var e;return this.hasSubtitle()?{list:p()(e=this.mediaPlayList.mediaList.subtitle).call(e,(e=>({lang:e.lang,codec:e.codecs}))),selectedIndex:this.subtitleResource.selectedIndex}:{list:[],selectedIndex:0}}selectVideo(e){if(e!==this.videoResource.selectedIndex&&this.hasVideo()&&e>=0&&e<this.mediaPlayList.mediaList.video.length){this.videoResource.selectedIndex=e;const n=this.mediaPlayList.mediaList.video[this.videoResource.selectedIndex];if(n.file)this.videoResource.segments=[{url:n.file}];else{var t,i;if(this.options.isLive){var s;let e=this.videoResource.segmentIndex;R()(s=this.videoResource.segments).call(s,((t,i)=>{if(t.url===this.videoResource.currentUri)return e=i,!0})),this.addHistory(this.videoResource,n.mediaSegments,e+1)}this.videoResource.segments=v()(t=[{url:n.initSegment}]).call(t,p()(i=n.mediaSegments).call(i,(e=>({url:e.url,pending:e.pending,duration:e.segmentDuration})))),this.videoResource.initSegmentPadding=n.initSegment}if(n.mediaSegments&&this.videoResource.segmentIndex-(n.initSegment?1:0)<n.mediaSegments.length-1)return n.mediaSegments[this.videoResource.segmentIndex+(n.initSegment?0:1)].start}return-1}selectAudio(e){if(e!==this.audioResource.selectedIndex&&this.hasAudio()&&e>=0&&e<this.mediaPlayList.mediaList.audio.length){this.audioResource.selectedIndex=e;const n=this.mediaPlayList.mediaList.audio[this.audioResource.selectedIndex];if(n.file)this.audioResource.segments=[{url:n.file}];else{var t,i;if(this.options.isLive){var s;let e=this.audioResource.segmentIndex;R()(s=this.audioResource.segments).call(s,((t,i)=>{if(t.url===this.audioResource.currentUri)return e=i,!0})),this.addHistory(this.audioResource,n.mediaSegments,e+1)}this.audioResource.segments=v()(t=[{url:n.initSegment}]).call(t,p()(i=n.mediaSegments).call(i,(e=>({url:e.url,pending:e.pending,duration:e.segmentDuration})))),this.audioResource.initSegmentPadding=n.initSegment}if(n.mediaSegments&&this.audioResource.segmentIndex-(n.initSegment?1:0)<n.mediaSegments.length-1)return n.mediaSegments[this.audioResource.segmentIndex+(n.initSegment?0:1)].start}return-1}selectSubtitle(e){if(e!==this.subtitleResource.selectedIndex&&this.hasSubtitle()&&e>=0&&e<this.mediaPlayList.mediaList.subtitle.length){this.subtitleResource.selectedIndex=e;const n=this.mediaPlayList.mediaList.subtitle[this.subtitleResource.selectedIndex];if(n.file)this.subtitleResource.segments=[{url:n.file}];else{var t,i;if(this.options.isLive){var s;let e=this.subtitleResource.segmentIndex;R()(s=this.subtitleResource.segments).call(s,((t,i)=>{if(t.url===this.subtitleResource.currentUri)return e=i,!0})),this.addHistory(this.subtitleResource,n.mediaSegments,e+1)}this.subtitleResource.segments=v()(t=[{url:n.initSegment}]).call(t,p()(i=n.mediaSegments).call(i,(e=>({url:e.url,pending:e.pending,duration:e.segmentDuration})))),this.subtitleResource.initSegmentPadding=n.initSegment}if(n.mediaSegments&&this.subtitleResource.segmentIndex-(n.initSegment?1:0)<n.mediaSegments.length-1)return n.mediaSegments[this.subtitleResource.segmentIndex+(n.initSegment?0:1)].start}return-1}getCurrentProtection(e){return 1===e?this.mediaPlayList.mediaList.audio[this.audioResource.selectedIndex].protection:0===e?this.mediaPlayList.mediaList.video[this.videoResource.selectedIndex].protection:void 0}getMinBuffer(){return this.minBuffer}}},7663:(e,t,i)=>{"use strict";var s=i(53457),n=i(39870),a=String.prototype;e.exports=function(e){var t=e.repeat;return"string"==typeof e||e===a||s(a,e)&&t===a.repeat?n:t}},9105:(e,t,i)=>{e.exports=i(59627)},15633:(e,t,i)=>{"use strict";var s=i(75068);e.exports=s},16712:()=>{},18050:(e,t,i)=>{"use strict";var s=i(53457),n=i(69094),a=Array.prototype;e.exports=function(e){var t=e.filter;return e===a||s(a,e)&&t===a.filter?n:t}},18885:(e,t,i)=>{"use strict";i(89838)({target:"String",proto:!0},{repeat:i(21061)})},21061:(e,t,i)=>{"use strict";var s=i(74371),n=i(42391),a=i(61726),r=RangeError;e.exports=function(e){var t=n(a(this)),i="",o=s(e);if(o<0||o===1/0)throw new r("Wrong number of repetitions");for(;o>0;(o>>>=1)&&(t+=t))1&o&&(i+=t);return i}},21263:()=>{},22887:(e,t,i)=>{e.exports=i(99001)},22998:(e,t,i)=>{"use strict";var s=i(89838),n=i(63637).some;s({target:"Array",proto:!0,forced:!i(62830)("some")},{some:function(e){return n(this,e,arguments.length>1?arguments[1]:void 0)}})},23874:(e,t,i)=>{"use strict";var s=i(89838),n=i(55701),a=i(89624),r=i(61726),o=i(35021),d=i(22890),l=i(54028),u=i(42391),c=i(46998),m=i(32354),h=i(59862),g=i(25563),p=i(51219),f=g("replace"),v=TypeError,S=a("".indexOf),y=a("".replace),L=a("".slice),R=Math.max;s({target:"String",proto:!0},{replaceAll:function(e,t){var i,s,a,g,b,x,P,A,w,I,T=r(this),D=0,B="";if(d(e)){if((i=l(e))&&(s=u(r(m(e))),!~S(s,"g")))throw new v("`.replaceAll` does not allow non-global regexes");if(a=c(e,f))return n(a,e,T,t);if(p&&i)return y(u(T),e,t)}for(g=u(T),b=u(e),(x=o(t))||(t=u(t)),P=b.length,A=R(1,P),w=S(g,b);-1!==w;)I=x?u(t(b,w,g)):h(b,g,w,[],void 0,t),B+=L(g,D,w)+I,D=w+P,w=w+A>g.length?-1:S(g,b,w+A);return D<g.length&&(B+=L(g,D)),B}})},26838:(e,t,i)=>{"use strict";var s=i(89838),n=i(63637).map;s({target:"Array",proto:!0,forced:!i(11437)("map")},{map:function(e){return n(this,e,arguments.length>1?arguments[1]:void 0)}})},32354:(e,t,i)=>{"use strict";var s=i(55701),n=i(95497),a=i(53457),r=i(95397),o=i(79827),d=RegExp.prototype;e.exports=r.correct?function(e){return e.flags}:function(e){return r.correct||!a(d,e)||n(e,"flags")?e.flags:s(o,e)}},34080:(e,t,i)=>{"use strict";i.d(t,{A:()=>d});var s=i(31519),n=i.n(s),a=i(21782);const r={aloneValueName:"_@attribute"},o=[" ","/",'"',"'","<",">"];function d(e,t=r){e=(e=(e=(e=e.replace(/<!--[\s\S]*?-->/g,"")).replace(/[\n\t\r]/g,"")).replace(/>[ \t]+</g,"><")).replace(/<\?[^>]*\?>/g,"");const i=[];let s=0;function d(e,s){const a=i[i.length-1];a&&(e!==t.aloneValueName||null==a.obj[t.aloneValueName]?null==a.obj[e]?a.obj[e]=s:n()(a.obj[e])?a.obj[e].push(s):a.obj[e]=[a.obj[e],s]:a.obj[t.aloneValueName]=[a.obj[t.aloneValueName],{tagName:e,...s}])}function l(t){for(;s<e.length;){if(e[s]===t)return!0;s++}return!1}function u(){c();let t="";for(;s<e.length&&!a.zy(o,e[s]);)t+=e[s],s++;return t}function c(){for(;s<e.length&&/\s|\r|\n/.test(e[s]);)s++}const m=/\s/,h=/'/,g=/"/;function p(){if(s>=e.length)return!0;c();let t=m;'"'!==e[s]&&"'"!=e[s]||(t='"'===e[s]?g:h,s++);let i="";for(;s<e.length;){if(t.test(e[s])){s++;break}i+=e[s],s++}return i}function f(){c();let t="";for(;s<e.length&&"<"!==e[s];)t+=e[s],s++;return t}function v(){for(;"<"===e[s];){const t=s;if(s++,c(),"/"!==e[s]){s=t;break}if(s++,u()===i[i.length-1].tag){if(i.length>1){const e=i.pop();d(e.tag,e.obj)}l(">"),s++,c()}else i.pop(),l(">"),s++,c()}}return function n(){if(s>=e.length)return;let a=s;if(c(),"<"!==e[s])return s=a,d(t.aloneValueName,f()),v(),n();let r=l("<");if(!r)return;a=s,s++;const o=u();if(i.push({obj:{},tag:o,start:a}),function(){for(;c(),">"!==e[s]&&"/"!==e[s];){let e=u();if(!e)break;"="===e[e.length-1]?e=e.substring(0,e.length-1):(l("="),s++),d(e,p())}}(),c(),"/"===e[s]){if(s++,i.length>1){const e=i.pop();d(e.tag,e.obj)}return l(">"),s++,v(),n()}r=l(">"),r&&(s++,c(),"<"!==e[s]&&(d(t.aloneValueName,f()),c()),v(),n())}(),{[i[0].tag]:i[0].obj}}},36606:(e,t,i)=>{"use strict";i(21263),i(16712),i(23874);var s=i(42244);e.exports=s("String","replaceAll")},37804:(e,t,i)=>{"use strict";i(22998);var s=i(42244);e.exports=s("Array","some")},39870:(e,t,i)=>{"use strict";i(18885);var s=i(42244);e.exports=s("String","repeat")},41450:(e,t,i)=>{e.exports=i(81460)},54028:(e,t,i)=>{"use strict";var s=i(22890),n=i(76280),a=i(25563)("match");e.exports=function(e){var t;return s(e)&&(void 0!==(t=e[a])?!!t:"RegExp"===n(e))}},55747:(e,t,i)=>{"use strict";var s=i(53457),n=i(90943),a=Array.prototype;e.exports=function(e){var t=e.find;return e===a||s(a,e)&&t===a.find?n:t}},55907:(e,t,i)=>{"use strict";i(63745);var s=i(74654);e.exports=s},57124:(e,t,i)=>{"use strict";var s=i(53457),n=i(83296),a=Array.prototype;e.exports=function(e){var t=e.concat;return e===a||s(a,e)&&t===a.concat?n:t}},58459:(e,t,i)=>{"use strict";var s=i(57124);e.exports=s},59627:(e,t,i)=>{"use strict";var s=i(73776);e.exports=s},59862:(e,t,i)=>{"use strict";var s=i(89624),n=i(76157),a=Math.floor,r=s("".charAt),o=s("".replace),d=s("".slice),l=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,u=/\$([$&'`]|\d{1,2})/g;e.exports=function(e,t,i,s,c,m){var h=i+e.length,g=s.length,p=u;return void 0!==c&&(c=n(c),p=l),o(m,p,(function(n,o){var l;switch(r(o,0)){case"$":return"$";case"&":return e;case"`":return d(t,0,i);case"'":return d(t,h);case"<":l=c[d(o,1,-1)];break;default:var u=+o;if(0===u)return n;if(u>g){var m=a(u/10);return 0===m?n:m<=g?void 0===s[m-1]?r(o,1):s[m-1]+r(o,1):n}l=s[u-1]}return void 0===l?"":l}))}},63745:(e,t,i)=>{"use strict";i(23874)},69094:(e,t,i)=>{"use strict";i(79168);var s=i(42244);e.exports=s("Array","filter")},71696:(e,t,i)=>{"use strict";i(26838);var s=i(42244);e.exports=s("Array","map")},73776:(e,t,i)=>{"use strict";var s=i(53457),n=i(37804),a=Array.prototype;e.exports=function(e){var t=e.some;return e===a||s(a,e)&&t===a.some?n:t}},74229:(e,t,i)=>{"use strict";e.exports=i(55907)},74654:(e,t,i)=>{"use strict";var s=i(15633);e.exports=s},75068:(e,t,i)=>{"use strict";var s=i(53457),n=i(36606),a=String.prototype;e.exports=function(e){var t=e.replaceAll;return"string"==typeof e||e===a||s(a,e)&&t===a.replaceAll?n:t}},77385:(e,t,i)=>{e.exports=i(58459)},79168:(e,t,i)=>{"use strict";var s=i(89838),n=i(63637).filter;s({target:"Array",proto:!0,forced:!i(11437)("filter")},{filter:function(e){return n(this,e,arguments.length>1?arguments[1]:void 0)}})},79827:(e,t,i)=>{"use strict";var s=i(66415);e.exports=function(){var e=s(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t}},81232:(e,t,i)=>{"use strict";var s=i(7663);e.exports=s},81460:(e,t,i)=>{"use strict";var s=i(55747);e.exports=s},82393:(e,t,i)=>{e.exports=i(74229)},83296:(e,t,i)=>{"use strict";i(62730);var s=i(42244);e.exports=s("Array","concat")},84214:(e,t,i)=>{"use strict";i.d(t,{A:()=>j});var s=i(15970),n=i.n(s),a=i(5029),r=i.n(a),o=i(93986),d=i.n(o),l=i(42399),u=i.n(l),c=i(82393),m=i.n(c),h=i(50442),g=i.n(h),p=i(18811),f=i.n(p),v=i(22608),S=i.n(v),y=i(92793),L=i.n(y),R=i(92983),b=i.n(R),x=i(41450),P=i.n(x),A=i(77385),w=i.n(A),I=i(17283),T=i(34492),D=i(34080),B=i(79579),U=i(96623);function M(e){const t=e.match(/^PT?(?:(\d+)Y)?(?:(\d+)D)?(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?$/);if(!t)throw new Error("Invalid DASH PT duration: "+e);const[,i,s,a,o,d]=t;return 3600*n()(i||"0")*24*365+3600*n()(s||"0")*24+3600*n()(a||"0")+60*n()(o||"0")+r()(d||"0")}function $(e,t){const i=(0,U.A)(e);return i.length>=t?i:d()("0").call("0",t-i.length)+i}function C(e){if(!e)return 0;if(u()(e).call(e,"/")>-1){const t=e.split("/");return r()(t[0])/r()(t[1])}return r()(e)}function H(e){e=m()(e).call(e,"-","");const t=[];for(let i=0;i<e.length;i+=2)t.push(+`0x${e.substring(i,i+2)}`);return new Uint8Array(t)}function k(e){let t={};return g()(e).call(e,(e=>{const i={};if(T.each(e,((e,t)=>{i[t.toLocaleLowerCase()]=e})),i["cenc:default_kid"]&&(t.kid=H(i["cenc:default_kid"]),t.scheme=i.value),i.schemeiduri){const e=i.schemeiduri.split(":");3===e.length&&"urn"===e[0]&&"uuid"===e[1]&&(t.systemId=H(e[2]))}i["clearkey:laurl"]&&(t.url=i["clearkey:laurl"].value),i["dashif:laurl"]&&(t.url=i["dashif:laurl"].value)})),t}function O(e,t){return/^https?:\/\//.test(t)?t:e+t}function W(e,t,i){var s;const a={mediaList:{audio:[],video:[],subtitle:[]},type:"live",isEnd:!1,duration:0,minBufferTime:0,maxSegmentDuration:0,minimumUpdatePeriod:0,timeShiftBufferDepth:0,timestamp:(0,B.A)()},o=[];"static"===e.type&&(a.type="vod",a.isEnd=!0),e.minBufferTime&&(a.minBufferTime=M(e.minBufferTime)),e.maxSegmentDuration&&(a.maxSegmentDuration=M(e.maxSegmentDuration)),e.minimumUpdatePeriod&&(a.minimumUpdatePeriod=Math.min(M(e.minimumUpdatePeriod),30*Math.max(a.maxSegmentDuration,2))),e.availabilityStartTime&&(a.availabilityStartTime=new Date(e.availabilityStartTime).getTime()),e.timeShiftBufferDepth&&(a.timeShiftBufferDepth=M(e.timeShiftBufferDepth)),e.mediaPresentationDuration&&(a.duration=M(e.mediaPresentationDuration));let d="";e.BaseURL&&(d=I.YO(e.BaseURL)?e.BaseURL[0].value:I.Yj(e.BaseURL)?e.BaseURL:e.BaseURL.value),null!=t&&t.duration&&(a.duration=M(t.duration)),t.BaseURL&&(d=O(d,I.Yj(t.BaseURL)?t.BaseURL:t.BaseURL.value));const l=I.YO(t.AdaptationSet)?t.AdaptationSet:[t.AdaptationSet];return g()(l).call(l,((e,t)=>{let s,l="",c="",m="",h=0,p=0,v=0,y=0,L=0,R="1:1",b="1",x=0,P=d,A="und";e.BaseURL&&(P=O(P,I.Yj(e.BaseURL)?e.BaseURL:e.BaseURL.value)),e.lang&&(A=e.lang),e.mimeType||e.contentType?(l=e.mimeType,c=e.contentType,"video/mp4"===l||"video"===c?(m=e.codecs,h=r()(e.width),p=r()(e.height),e.maxWidth&&(v=r()(e.maxWidth)),e.maxHeight&&(y=r()(e.maxHeight)),e.frameRate&&(L=C(e.frameRate)),R=e.sar,b=e.startWithSAP,x=r()(e.bandwidth)):"audio/mp4"!==l&&"audio"!==c||(m=e.codecs,b=e.startWithSAP,x=r()(e.bandwidth))):(e.maxWidth&&(v=r()(e.maxWidth)),e.maxHeight&&(y=r()(e.maxHeight)),e.frameRate&&(L=C(e.frameRate))),e.ContentProtection&&(s=k(e.ContentProtection));const w=I.YO(e.Representation)?e.Representation:[e.Representation];g()(w).call(w,((t,d)=>{u()(o).call(o,t.id)>-1&&(t.id=(n()(o[o.length-1])+1).toString()),o.push(t.id);let g="";const w=[];let T=0,D=a.duration,M=O(f()(i).call(i,0,S()(i).call(i,"/")+1),P);if(t.mimeType&&(l=t.mimeType),"video/mp4"===l||"video"===c?(t.codecs&&(m=t.codecs),t.width&&(h=r()(t.width)),t.height&&(p=r()(t.height)),t.maxWidth&&(v=r()(t.maxWidth)),t.maxHeight&&(y=r()(t.maxHeight)),t.frameRate&&(L=r()(t.frameRate)),t.sar&&(R=t.sar),t.startWithSAP&&(b=t.startWithSAP),t.bandwidth&&(x=r()(t.bandwidth))):(t.codecs&&(m=t.codecs),t.startWithSAP&&(b=t.startWithSAP),t.bandwidth&&(x=r()(t.bandwidth))),t.BaseURL&&(M=O(M,I.Yj(t.BaseURL)?t.BaseURL:t.BaseURL.value)),t.ContentProtection&&(s=k(t.ContentProtection)),t.SegmentBase)"video/mp4"===l||"video"===c?a.mediaList.video.push({id:t.id,file:M,mimeType:l,codecs:m,width:h,height:p,maxWidth:v,maxHeight:y,frameRate:L,sar:R,startWithSAP:"1"===b,bandwidth:x,timescale:T,duration:D,protection:s}):"audio/mp4"===l||"audio"===c?a.mediaList.audio.push({id:t.id,file:M,mimeType:l,codecs:m,startWithSAP:"1"===b,bandwidth:x,timescale:T,duration:D,protection:s,lang:A}):"application/mp4"!==l&&"text"!==c||a.mediaList.subtitle.push({id:t.id,file:M,mimeType:l,codecs:m,startWithSAP:"1"===b,bandwidth:x,timescale:T,duration:D,protection:s,lang:A});else{let i;if(e.SegmentTemplate&&(i=I.YO(e.SegmentTemplate)?e.SegmentTemplate[0]:e.SegmentTemplate),t.SegmentTemplate&&(i=I.YO(t.SegmentTemplate)?t.SegmentTemplate[0]:t.SegmentTemplate),i){let e=i.startNumber?n()(i.startNumber):1;if(g=i.initialization,T=r()(i.timescale||"1"),i.duration&&!i.SegmentTimeline){D=r()(i.duration);let s=D/T,o=e+Math.ceil((a.duration||s)/s)-1,d=o;if("live"===a.type&&(I.ai(a.availabilityStartTime)||i.presentationTimeOffset)){const t=((a.timestamp||(0,B.A)())-a.availabilityStartTime)/1e3-(i.presentationTimeOffset?n()(i.presentationTimeOffset):0);o=e+Math.floor(t/s),a.timeShiftBufferDepth&&(e=o-Math.ceil(a.timeShiftBufferDepth/s)+1),d=o,("false"===i.availabilityTimeComplete||a.minimumUpdatePeriod>2*a.minBufferTime)&&(o+=Math.ceil(a.minimumUpdatePeriod/s))}for(let n=e;n<=o;n++){const r=s*(n-e);let l=s*(n-e+1);n===o&&a.duration&&(s=a.duration-s*(o-e),l=a.duration),w.push({idx:n,start:r,end:l,url:M+i.media.replace(/\$RepresentationID\$/g,t.id).replace(/\$Number(%(\d+)d)?\$/g,((e,t,i)=>i?$(n,+i):(0,U.A)(n))),segmentDuration:s,pending:n>d})}}else if(i.SegmentTimeline&&i.SegmentTimeline.S){const s=I.YO(i.SegmentTimeline.S)?i.SegmentTimeline.S:[i.SegmentTimeline.S];let a=0,o=e;for(let e=0;e<s.length;e++){let d=r()(s[e].d);s[e].t&&(a=r()(s[e].t));let l=1;s[e].r&&(l=n()(s[e].r),-1===l&&D?l=Math.ceil(D*T/d):l+=1);for(let e=0;e<l;e++)w.push({idx:o,start:a/T,end:(a+d)/T,url:M+i.media.replace(/\$RepresentationID\$/g,t.id).replace(/\$Number(%(\d+)d)?\$/g,((e,t,i)=>i?$(o,+i):(0,U.A)(o))).replace(/\$Time\$/g,(0,U.A)(a)),segmentDuration:d/T}),o++,a+=d}}}else if(t.SegmentList){const e=I.YO(t.SegmentList.SegmentURL)?t.SegmentList.SegmentURL:[t.SegmentList.SegmentURL];let i=0,s=r()(t.SegmentList.duration);for(let t=0;t<e.length;t++)w.push({idx:t,start:i/T,end:(i+s)/T,url:M+e[t].media,segmentDuration:s/T}),i+=s}"video/mp4"===l||"video"===c?a.mediaList.video.push({id:t.id,baseURL:M,initSegment:M+g.replace(/\$RepresentationID\$/g,t.id).replace(/\$Bandwidth\$/g,(0,U.A)(x)),mediaSegments:w,mimeType:l,codecs:m,width:h,height:p,maxWidth:v,maxHeight:y,frameRate:L,sar:R,startWithSAP:"1"===b,bandwidth:x,timescale:T,duration:D,protection:s}):"audio/mp4"===l||"audio"===c?a.mediaList.audio.push({id:t.id,baseURL:M,initSegment:M+g.replace(/\$RepresentationID\$/g,t.id).replace(/\$Bandwidth\$/g,(0,U.A)(x)),mediaSegments:w,mimeType:l,codecs:m,startWithSAP:"1"===b,bandwidth:x,timescale:T,duration:D,protection:s,lang:A}):"application/mp4"!==l&&"text"!==c||a.mediaList.subtitle.push({id:t.id,baseURL:M,initSegment:M+g.replace(/\$RepresentationID\$/g,t.id).replace(/\$Bandwidth\$/g,(0,U.A)(x)),mediaSegments:w,mimeType:l,codecs:m,startWithSAP:"1"===b,bandwidth:x,timescale:T,duration:D,protection:s,lang:A})}}))})),g()(s=["video","audio"]).call(s,(e=>{var t;L()(t=a.mediaList[e]).call(t,((e,t)=>e.bandwidth-t.bandwidth))})),a}function j(e,t){const i=(s=e,s?(0,D.A)(s,{aloneValueName:"value"}):null).MPD;var s;if("dynamic"===i.type){const e=I.YO(i.Period)?i.Period[i.Period.length-1]:i.Period;return W(i,e,t)}{const e=I.YO(i.Period)?i.Period:[i.Period],s=b()(e).call(e,(e=>W(i,e,t))),o=s[0];for(let e=1;e<s.length;e++){var n,a,r;o.duration+=s[e].duration,g()(n=s[e].mediaList.video).call(n,(e=>{var t;const i=P()(t=o.mediaList.video).call(t,(t=>e.initSegment&&e.initSegment===t.initSegment||e.id===t.id));var s,n,a,r;i?(null!==(s=i.mediaSegments)&&void 0!==s&&s.length&&null!==(n=e.mediaSegments)&&void 0!==n&&n.length&&g()(r=e.mediaSegments).call(r,(e=>{e.start+=i.mediaSegments[i.mediaSegments.length-1].end,e.end+=i.mediaSegments[i.mediaSegments.length-1].end})),i.mediaSegments=w()(a=i.mediaSegments||[]).call(a,e.mediaSegments||[])):o.mediaList.video.push(e)})),g()(a=s[e].mediaList.audio).call(a,(e=>{var t;const i=P()(t=o.mediaList.audio).call(t,(t=>e.initSegment&&e.initSegment===t.initSegment||e.id===t.id));var s,n,a,r;i?(null!==(s=i.mediaSegments)&&void 0!==s&&s.length&&null!==(n=e.mediaSegments)&&void 0!==n&&n.length&&g()(r=e.mediaSegments).call(r,(e=>{e.start+=i.mediaSegments[i.mediaSegments.length-1].end,e.end+=i.mediaSegments[i.mediaSegments.length-1].end})),i.mediaSegments=w()(a=i.mediaSegments||[]).call(a,e.mediaSegments||[])):o.mediaList.audio.push(e)})),g()(r=s[e].mediaList.subtitle).call(r,(e=>{var t;const i=P()(t=o.mediaList.subtitle).call(t,(t=>e.initSegment&&e.initSegment===t.initSegment||e.id===t.id));var s,n,a,r;i?(null!==(s=i.mediaSegments)&&void 0!==s&&s.length&&null!==(n=e.mediaSegments)&&void 0!==n&&n.length&&g()(r=e.mediaSegments).call(r,(e=>{e.start+=i.mediaSegments[i.mediaSegments.length-1].end,e.end+=i.mediaSegments[i.mediaSegments.length-1].end})),i.mediaSegments=w()(a=i.mediaSegments||[]).call(a,e.mediaSegments||[])):o.mediaList.subtitle.push(e)}))}return i.mediaPresentationDuration&&(o.duration=M(i.mediaPresentationDuration)),o}}},84636:(e,t,i)=>{"use strict";var s=i(53457),n=i(71696),a=Array.prototype;e.exports=function(e){var t=e.map;return e===a||s(a,e)&&t===a.map?n:t}},88745:(e,t,i)=>{"use strict";var s=i(89838),n=i(63637).find,a=i(51645),r="find",o=!0;r in[]&&Array(1)[r]((function(){o=!1})),s({target:"Array",proto:!0,forced:o},{find:function(e){return n(this,e,arguments.length>1?arguments[1]:void 0)}}),a(r)},90943:(e,t,i)=>{"use strict";i(88745);var s=i(42244);e.exports=s("Array","find")},92983:(e,t,i)=>{e.exports=i(99845)},93986:(e,t,i)=>{e.exports=i(81232)},95397:(e,t,i)=>{"use strict";var s=i(58184),n=i(81767),a=s.RegExp,r=!n((function(){var e=!0;try{a(".","d")}catch(t){e=!1}var t={},i="",s=e?"dgimsy":"gimsy",n=function(e,s){Object.defineProperty(t,e,{get:function(){return i+=s,!0}})},r={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var o in e&&(r.hasIndices="d"),r)n(o,r[o]);return Object.getOwnPropertyDescriptor(a.prototype,"flags").get.call(t)!==s||i!==s}));e.exports={correct:r}},99001:(e,t,i)=>{"use strict";var s=i(18050);e.exports=s},99845:(e,t,i)=>{"use strict";var s=i(84636);e.exports=s}}]);
|