@kenzuya/mediabunny 1.26.0 → 1.28.6
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/README.md +1 -1
- package/dist/bundles/{mediabunny.mjs → mediabunny.js} +21963 -21390
- package/dist/bundles/mediabunny.min.js +490 -0
- package/dist/modules/shared/mp3-misc.d.ts.map +1 -1
- package/dist/modules/src/adts/adts-demuxer.d.ts +6 -6
- package/dist/modules/src/adts/adts-demuxer.d.ts.map +1 -1
- package/dist/modules/src/adts/adts-muxer.d.ts +4 -4
- package/dist/modules/src/adts/adts-muxer.d.ts.map +1 -1
- package/dist/modules/src/adts/adts-reader.d.ts +1 -1
- package/dist/modules/src/adts/adts-reader.d.ts.map +1 -1
- package/dist/modules/src/avi/avi-demuxer.d.ts +44 -0
- package/dist/modules/src/avi/avi-demuxer.d.ts.map +1 -0
- package/dist/modules/src/avi/avi-misc.d.ts +88 -0
- package/dist/modules/src/avi/avi-misc.d.ts.map +1 -0
- package/dist/modules/src/avi/avi-muxer.d.ts +45 -0
- package/dist/modules/src/avi/avi-muxer.d.ts.map +1 -0
- package/dist/modules/src/avi/riff-writer.d.ts +26 -0
- package/dist/modules/src/avi/riff-writer.d.ts.map +1 -0
- package/dist/modules/src/codec-data.d.ts +8 -3
- package/dist/modules/src/codec-data.d.ts.map +1 -1
- package/dist/modules/src/codec.d.ts +10 -10
- package/dist/modules/src/codec.d.ts.map +1 -1
- package/dist/modules/src/conversion.d.ts +33 -16
- package/dist/modules/src/conversion.d.ts.map +1 -1
- package/dist/modules/src/custom-coder.d.ts +8 -8
- package/dist/modules/src/custom-coder.d.ts.map +1 -1
- package/dist/modules/src/demuxer.d.ts +3 -3
- package/dist/modules/src/demuxer.d.ts.map +1 -1
- package/dist/modules/src/encode.d.ts +8 -8
- package/dist/modules/src/encode.d.ts.map +1 -1
- package/dist/modules/src/flac/flac-demuxer.d.ts +7 -7
- package/dist/modules/src/flac/flac-demuxer.d.ts.map +1 -1
- package/dist/modules/src/flac/flac-misc.d.ts +3 -3
- package/dist/modules/src/flac/flac-misc.d.ts.map +1 -1
- package/dist/modules/src/flac/flac-muxer.d.ts +5 -5
- package/dist/modules/src/flac/flac-muxer.d.ts.map +1 -1
- package/dist/modules/src/id3.d.ts +3 -3
- package/dist/modules/src/id3.d.ts.map +1 -1
- package/dist/modules/src/index.d.ts +20 -20
- package/dist/modules/src/index.d.ts.map +1 -1
- package/dist/modules/src/input-format.d.ts +22 -0
- package/dist/modules/src/input-format.d.ts.map +1 -1
- package/dist/modules/src/input-track.d.ts +8 -8
- package/dist/modules/src/input-track.d.ts.map +1 -1
- package/dist/modules/src/input.d.ts +12 -12
- package/dist/modules/src/isobmff/isobmff-boxes.d.ts +2 -2
- package/dist/modules/src/isobmff/isobmff-boxes.d.ts.map +1 -1
- package/dist/modules/src/isobmff/isobmff-demuxer.d.ts +12 -12
- package/dist/modules/src/isobmff/isobmff-demuxer.d.ts.map +1 -1
- package/dist/modules/src/isobmff/isobmff-misc.d.ts.map +1 -1
- package/dist/modules/src/isobmff/isobmff-muxer.d.ts +11 -11
- package/dist/modules/src/isobmff/isobmff-muxer.d.ts.map +1 -1
- package/dist/modules/src/isobmff/isobmff-reader.d.ts +2 -2
- package/dist/modules/src/isobmff/isobmff-reader.d.ts.map +1 -1
- package/dist/modules/src/matroska/ebml.d.ts +3 -3
- package/dist/modules/src/matroska/ebml.d.ts.map +1 -1
- package/dist/modules/src/matroska/matroska-demuxer.d.ts +13 -13
- package/dist/modules/src/matroska/matroska-demuxer.d.ts.map +1 -1
- package/dist/modules/src/matroska/matroska-input.d.ts +33 -0
- package/dist/modules/src/matroska/matroska-input.d.ts.map +1 -0
- package/dist/modules/src/matroska/matroska-misc.d.ts.map +1 -1
- package/dist/modules/src/matroska/matroska-muxer.d.ts +5 -5
- package/dist/modules/src/matroska/matroska-muxer.d.ts.map +1 -1
- package/dist/modules/src/media-sink.d.ts +5 -5
- package/dist/modules/src/media-sink.d.ts.map +1 -1
- package/dist/modules/src/media-source.d.ts +22 -4
- package/dist/modules/src/media-source.d.ts.map +1 -1
- package/dist/modules/src/metadata.d.ts +2 -2
- package/dist/modules/src/metadata.d.ts.map +1 -1
- package/dist/modules/src/misc.d.ts +5 -4
- package/dist/modules/src/misc.d.ts.map +1 -1
- package/dist/modules/src/mp3/mp3-demuxer.d.ts +7 -7
- package/dist/modules/src/mp3/mp3-demuxer.d.ts.map +1 -1
- package/dist/modules/src/mp3/mp3-muxer.d.ts +4 -4
- package/dist/modules/src/mp3/mp3-muxer.d.ts.map +1 -1
- package/dist/modules/src/mp3/mp3-reader.d.ts +2 -2
- package/dist/modules/src/mp3/mp3-reader.d.ts.map +1 -1
- package/dist/modules/src/mp3/mp3-writer.d.ts +1 -1
- package/dist/modules/src/mp3/mp3-writer.d.ts.map +1 -1
- package/dist/modules/src/muxer.d.ts +4 -4
- package/dist/modules/src/muxer.d.ts.map +1 -1
- package/dist/modules/src/ogg/ogg-demuxer.d.ts +7 -7
- package/dist/modules/src/ogg/ogg-demuxer.d.ts.map +1 -1
- package/dist/modules/src/ogg/ogg-misc.d.ts +1 -1
- package/dist/modules/src/ogg/ogg-misc.d.ts.map +1 -1
- package/dist/modules/src/ogg/ogg-muxer.d.ts +5 -5
- package/dist/modules/src/ogg/ogg-muxer.d.ts.map +1 -1
- package/dist/modules/src/ogg/ogg-reader.d.ts +1 -1
- package/dist/modules/src/ogg/ogg-reader.d.ts.map +1 -1
- package/dist/modules/src/output-format.d.ts +51 -6
- package/dist/modules/src/output-format.d.ts.map +1 -1
- package/dist/modules/src/output.d.ts +13 -13
- package/dist/modules/src/output.d.ts.map +1 -1
- package/dist/modules/src/packet.d.ts +1 -1
- package/dist/modules/src/packet.d.ts.map +1 -1
- package/dist/modules/src/pcm.d.ts.map +1 -1
- package/dist/modules/src/reader.d.ts +2 -2
- package/dist/modules/src/reader.d.ts.map +1 -1
- package/dist/modules/src/sample.d.ts +57 -15
- package/dist/modules/src/sample.d.ts.map +1 -1
- package/dist/modules/src/source.d.ts +3 -3
- package/dist/modules/src/source.d.ts.map +1 -1
- package/dist/modules/src/subtitles.d.ts +1 -1
- package/dist/modules/src/subtitles.d.ts.map +1 -1
- package/dist/modules/src/target.d.ts +2 -2
- package/dist/modules/src/target.d.ts.map +1 -1
- package/dist/modules/src/tsconfig.tsbuildinfo +1 -1
- package/dist/modules/src/wave/riff-writer.d.ts +1 -1
- package/dist/modules/src/wave/riff-writer.d.ts.map +1 -1
- package/dist/modules/src/wave/wave-demuxer.d.ts +6 -6
- package/dist/modules/src/wave/wave-demuxer.d.ts.map +1 -1
- package/dist/modules/src/wave/wave-muxer.d.ts +4 -4
- package/dist/modules/src/wave/wave-muxer.d.ts.map +1 -1
- package/dist/modules/src/writer.d.ts +1 -1
- package/dist/modules/src/writer.d.ts.map +1 -1
- package/dist/packages/eac3/eac3.wasm +0 -0
- package/dist/packages/eac3/mediabunny-eac3.js +1058 -0
- package/dist/packages/eac3/mediabunny-eac3.min.js +44 -0
- package/dist/packages/mp3-encoder/mediabunny-mp3-encoder.js +694 -0
- package/dist/packages/mp3-encoder/mediabunny-mp3-encoder.min.js +58 -0
- package/dist/packages/mpeg4/mediabunny-mpeg4.js +1198 -0
- package/dist/packages/mpeg4/mediabunny-mpeg4.min.js +44 -0
- package/dist/packages/mpeg4/xvid.wasm +0 -0
- package/package.json +18 -57
- package/dist/bundles/mediabunny.cjs +0 -26140
- package/dist/bundles/mediabunny.min.cjs +0 -147
- package/dist/bundles/mediabunny.min.mjs +0 -146
- package/dist/mediabunny.d.ts +0 -3319
- package/dist/modules/shared/mp3-misc.js +0 -147
- package/dist/modules/src/adts/adts-demuxer.js +0 -239
- package/dist/modules/src/adts/adts-muxer.js +0 -80
- package/dist/modules/src/adts/adts-reader.js +0 -63
- package/dist/modules/src/codec-data.js +0 -1730
- package/dist/modules/src/codec.js +0 -869
- package/dist/modules/src/conversion.js +0 -1459
- package/dist/modules/src/custom-coder.js +0 -117
- package/dist/modules/src/demuxer.js +0 -12
- package/dist/modules/src/encode.js +0 -442
- package/dist/modules/src/flac/flac-demuxer.js +0 -504
- package/dist/modules/src/flac/flac-misc.js +0 -135
- package/dist/modules/src/flac/flac-muxer.js +0 -222
- package/dist/modules/src/id3.js +0 -848
- package/dist/modules/src/index.js +0 -28
- package/dist/modules/src/input-format.js +0 -480
- package/dist/modules/src/input-track.js +0 -372
- package/dist/modules/src/input.js +0 -188
- package/dist/modules/src/isobmff/isobmff-boxes.js +0 -1480
- package/dist/modules/src/isobmff/isobmff-demuxer.js +0 -2618
- package/dist/modules/src/isobmff/isobmff-misc.js +0 -20
- package/dist/modules/src/isobmff/isobmff-muxer.js +0 -966
- package/dist/modules/src/isobmff/isobmff-reader.js +0 -72
- package/dist/modules/src/matroska/ebml.js +0 -653
- package/dist/modules/src/matroska/matroska-demuxer.js +0 -2133
- package/dist/modules/src/matroska/matroska-misc.js +0 -20
- package/dist/modules/src/matroska/matroska-muxer.js +0 -1017
- package/dist/modules/src/media-sink.js +0 -1736
- package/dist/modules/src/media-source.js +0 -1825
- package/dist/modules/src/metadata.js +0 -193
- package/dist/modules/src/misc.js +0 -623
- package/dist/modules/src/mp3/mp3-demuxer.js +0 -285
- package/dist/modules/src/mp3/mp3-muxer.js +0 -123
- package/dist/modules/src/mp3/mp3-reader.js +0 -26
- package/dist/modules/src/mp3/mp3-writer.js +0 -78
- package/dist/modules/src/muxer.js +0 -50
- package/dist/modules/src/node.d.ts +0 -9
- package/dist/modules/src/node.d.ts.map +0 -1
- package/dist/modules/src/node.js +0 -9
- package/dist/modules/src/ogg/ogg-demuxer.js +0 -763
- package/dist/modules/src/ogg/ogg-misc.js +0 -78
- package/dist/modules/src/ogg/ogg-muxer.js +0 -353
- package/dist/modules/src/ogg/ogg-reader.js +0 -65
- package/dist/modules/src/output-format.js +0 -527
- package/dist/modules/src/output.js +0 -300
- package/dist/modules/src/packet.js +0 -182
- package/dist/modules/src/pcm.js +0 -85
- package/dist/modules/src/reader.js +0 -236
- package/dist/modules/src/sample.js +0 -1056
- package/dist/modules/src/source.js +0 -1182
- package/dist/modules/src/subtitles.js +0 -575
- package/dist/modules/src/target.js +0 -140
- package/dist/modules/src/wave/riff-writer.js +0 -30
- package/dist/modules/src/wave/wave-demuxer.js +0 -447
- package/dist/modules/src/wave/wave-muxer.js +0 -318
- package/dist/modules/src/writer.js +0 -370
- package/src/adts/adts-demuxer.ts +0 -331
- package/src/adts/adts-muxer.ts +0 -111
- package/src/adts/adts-reader.ts +0 -85
- package/src/codec-data.ts +0 -2078
- package/src/codec.ts +0 -1092
- package/src/conversion.ts +0 -2112
- package/src/custom-coder.ts +0 -197
- package/src/demuxer.ts +0 -24
- package/src/encode.ts +0 -739
- package/src/flac/flac-demuxer.ts +0 -730
- package/src/flac/flac-misc.ts +0 -164
- package/src/flac/flac-muxer.ts +0 -320
- package/src/id3.ts +0 -925
- package/src/index.ts +0 -221
- package/src/input-format.ts +0 -541
- package/src/input-track.ts +0 -529
- package/src/input.ts +0 -235
- package/src/isobmff/isobmff-boxes.ts +0 -1719
- package/src/isobmff/isobmff-demuxer.ts +0 -3190
- package/src/isobmff/isobmff-misc.ts +0 -29
- package/src/isobmff/isobmff-muxer.ts +0 -1348
- package/src/isobmff/isobmff-reader.ts +0 -91
- package/src/matroska/ebml.ts +0 -730
- package/src/matroska/matroska-demuxer.ts +0 -2481
- package/src/matroska/matroska-misc.ts +0 -29
- package/src/matroska/matroska-muxer.ts +0 -1276
- package/src/media-sink.ts +0 -2179
- package/src/media-source.ts +0 -2243
- package/src/metadata.ts +0 -320
- package/src/misc.ts +0 -798
- package/src/mp3/mp3-demuxer.ts +0 -383
- package/src/mp3/mp3-muxer.ts +0 -166
- package/src/mp3/mp3-reader.ts +0 -34
- package/src/mp3/mp3-writer.ts +0 -120
- package/src/muxer.ts +0 -88
- package/src/node.ts +0 -11
- package/src/ogg/ogg-demuxer.ts +0 -1053
- package/src/ogg/ogg-misc.ts +0 -116
- package/src/ogg/ogg-muxer.ts +0 -497
- package/src/ogg/ogg-reader.ts +0 -93
- package/src/output-format.ts +0 -945
- package/src/output.ts +0 -488
- package/src/packet.ts +0 -263
- package/src/pcm.ts +0 -112
- package/src/reader.ts +0 -323
- package/src/sample.ts +0 -1461
- package/src/source.ts +0 -1688
- package/src/subtitles.ts +0 -711
- package/src/target.ts +0 -204
- package/src/tsconfig.json +0 -16
- package/src/wave/riff-writer.ts +0 -36
- package/src/wave/wave-demuxer.ts +0 -529
- package/src/wave/wave-muxer.ts +0 -371
- package/src/writer.ts +0 -490
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2025-present, Vanilagy and contributors
|
|
3
|
+
*
|
|
4
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
5
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
6
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
7
|
+
*/
|
|
8
|
+
/*!
|
|
9
|
+
* Copyright (c) 2025-present, Vanilagy and contributors
|
|
10
|
+
*
|
|
11
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
12
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
13
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
14
|
+
*/function G(Q){if(!Q)throw Error("Assertion failed.")}var H=(Q)=>{if(Q.constructor===Uint8Array)return Q;if(ArrayBuffer.isView(Q))return new Uint8Array(Q.buffer,Q.byteOffset,Q.byteLength);if(typeof SharedArrayBuffer<"u"&&Q instanceof SharedArrayBuffer)return new Uint8Array(Q);return new Uint8Array(Q)};var C=(Q)=>{return Object.fromEntries(Object.entries(Q).map(([Y,J])=>[J,Y]))},e={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},IQ=C(e),QQ={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},zQ=C(QQ),YQ={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},LQ=C(YQ);var f=(Q)=>{return Q instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&Q instanceof SharedArrayBuffer||ArrayBuffer.isView(Q)};class JQ{currentPromise=Promise.resolve();async acquire(){let Q,Y=new Promise((U)=>{Q=U}),J=this.currentPromise;return this.currentPromise=Y,await J,Q}}var h=(Q)=>{throw Error(`Unexpected value: ${Q}`)};var j=1e6*(1+Number.EPSILON);class UQ{currentPromise=Promise.resolve();call(Q){return this.currentPromise=this.currentPromise.then(Q)}}var O=null,m=()=>{if(O!==null)return O;return O=typeof navigator<"u"&&navigator.userAgent?.includes("Firefox")};var u=()=>{Symbol.dispose??=Symbol("Symbol.dispose")};/*!
|
|
15
|
+
* Copyright (c) 2025-present, Vanilagy and contributors
|
|
16
|
+
*
|
|
17
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
18
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
19
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
20
|
+
*/class E{codec;config;onSample;static supports(Q,Y){return!1}}class D{codec;config;onSample;static supports(Q,Y){return!1}}class F{codec;config;onPacket;static supports(Q,Y){return!1}}class w{codec;config;onPacket;static supports(Q,Y){return!1}}var p=[],l=[],c=[],d=[],b=(Q)=>{if(Q.prototype instanceof E){let Y=Q;if(p.includes(Y)){console.warn("Video decoder already registered.");return}p.push(Y)}else if(Q.prototype instanceof D){let Y=Q;if(l.includes(Y)){console.warn("Audio decoder already registered.");return}l.push(Y)}else throw TypeError("Decoder must be a CustomVideoDecoder or CustomAudioDecoder.")},g=(Q)=>{if(Q.prototype instanceof F){let Y=Q;if(c.includes(Y)){console.warn("Video encoder already registered.");return}c.push(Y)}else if(Q.prototype instanceof w){let Y=Q;if(d.includes(Y)){console.warn("Audio encoder already registered.");return}d.push(Y)}else throw TypeError("Encoder must be a CustomVideoEncoder or CustomAudioEncoder.")};/*!
|
|
21
|
+
* Copyright (c) 2025-present, Vanilagy and contributors
|
|
22
|
+
*
|
|
23
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
24
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
25
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
26
|
+
*/var r=new Uint8Array(0);class S{data;type;timestamp;duration;sequenceNumber;byteLength;sideData;constructor(Q,Y,J,U,$=-1,M,K){this.data=Q;this.type=Y;this.timestamp=J;this.duration=U;this.sequenceNumber=$;if(Q===r&&M===void 0)throw Error("Internal error: byteLength must be explicitly provided when constructing metadata-only packets.");if(M===void 0)M=Q.byteLength;if(!(Q instanceof Uint8Array))throw TypeError("data must be a Uint8Array.");if(Y!=="key"&&Y!=="delta")throw TypeError('type must be either "key" or "delta".');if(!Number.isFinite(J))throw TypeError("timestamp must be a number.");if(!Number.isFinite(U)||U<0)throw TypeError("duration must be a non-negative number.");if(!Number.isFinite($))throw TypeError("sequenceNumber must be a number.");if(!Number.isInteger(M)||M<0)throw TypeError("byteLength must be a non-negative integer.");if(K!==void 0&&(typeof K!=="object"||!K))throw TypeError("sideData, when provided, must be an object.");if(K?.alpha!==void 0&&!(K.alpha instanceof Uint8Array))throw TypeError("sideData.alpha, when provided, must be a Uint8Array.");if(K?.alphaByteLength!==void 0&&(!Number.isInteger(K.alphaByteLength)||K.alphaByteLength<0))throw TypeError("sideData.alphaByteLength, when provided, must be a non-negative integer.");if(this.byteLength=M,this.sideData=K??{},this.sideData.alpha&&this.sideData.alphaByteLength===void 0)this.sideData.alphaByteLength=this.sideData.alpha.byteLength}get isMetadataOnly(){return this.data===r}get microsecondTimestamp(){return Math.trunc(j*this.timestamp)}get microsecondDuration(){return Math.trunc(j*this.duration)}toEncodedVideoChunk(){if(this.isMetadataOnly)throw TypeError("Metadata-only packets cannot be converted to a video chunk.");if(typeof EncodedVideoChunk>"u")throw Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}alphaToEncodedVideoChunk(Q=this.type){if(!this.sideData.alpha)throw TypeError("This packet does not contain alpha side data.");if(this.isMetadataOnly)throw TypeError("Metadata-only packets cannot be converted to a video chunk.");if(typeof EncodedVideoChunk>"u")throw Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.sideData.alpha,type:Q,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}toEncodedAudioChunk(){if(this.isMetadataOnly)throw TypeError("Metadata-only packets cannot be converted to an audio chunk.");if(typeof EncodedAudioChunk>"u")throw Error("Your browser does not support EncodedAudioChunk.");return new EncodedAudioChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}static fromEncodedChunk(Q,Y){if(!(Q instanceof EncodedVideoChunk||Q instanceof EncodedAudioChunk))throw TypeError("chunk must be an EncodedVideoChunk or EncodedAudioChunk.");let J=new Uint8Array(Q.byteLength);return Q.copyTo(J),new S(J,Q.type,Q.timestamp/1e6,(Q.duration??0)/1e6,void 0,void 0,Y)}clone(Q){if(Q!==void 0&&(typeof Q!=="object"||Q===null))throw TypeError("options, when provided, must be an object.");if(Q?.timestamp!==void 0&&!Number.isFinite(Q.timestamp))throw TypeError("options.timestamp, when provided, must be a number.");if(Q?.duration!==void 0&&!Number.isFinite(Q.duration))throw TypeError("options.duration, when provided, must be a number.");return new S(this.data,this.type,Q?.timestamp??this.timestamp,Q?.duration??this.duration,this.sequenceNumber,this.byteLength)}}/*!
|
|
27
|
+
* Copyright (c) 2025-present, Vanilagy and contributors
|
|
28
|
+
*
|
|
29
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
30
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
31
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
32
|
+
*/u();var s=-1/0,o=-1/0,x=null;if(typeof FinalizationRegistry<"u")x=new FinalizationRegistry((Q)=>{let Y=Date.now();if(Q.type==="video"){if(Y-s>=1000)console.error("A VideoSample was garbage collected without first being closed. For proper resource management, make sure to call close() on all your VideoSamples as soon as you're done using them."),s=Y;if(typeof VideoFrame<"u"&&Q.data instanceof VideoFrame)Q.data.close()}else{if(Y-o>=1000)console.error("An AudioSample was garbage collected without first being closed. For proper resource management, make sure to call close() on all your AudioSamples as soon as you're done using them."),o=Y;if(typeof AudioData<"u"&&Q.data instanceof AudioData)Q.data.close()}});var y=["I420","I420P10","I420P12","I420A","I420AP10","I420AP12","I422","I422P10","I422P12","I422A","I422AP10","I422AP12","I444","I444P10","I444P12","I444A","I444AP10","I444AP12","NV12","RGBA","RGBX","BGRA","BGRX"],$Q=new Set(y);class A{_data;_layout;_closed=!1;format;codedWidth;codedHeight;rotation;timestamp;duration;colorSpace;get displayWidth(){return this.rotation%180===0?this.codedWidth:this.codedHeight}get displayHeight(){return this.rotation%180===0?this.codedHeight:this.codedWidth}get microsecondTimestamp(){return Math.trunc(j*this.timestamp)}get microsecondDuration(){return Math.trunc(j*this.duration)}get hasAlpha(){return this.format&&this.format.includes("A")}constructor(Q,Y){if(Q instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&Q instanceof SharedArrayBuffer||ArrayBuffer.isView(Q)){if(!Y||typeof Y!=="object")throw TypeError("init must be an object.");if(Y.format===void 0||!$Q.has(Y.format))throw TypeError("init.format must be one of: "+y.join(", "));if(!Number.isInteger(Y.codedWidth)||Y.codedWidth<=0)throw TypeError("init.codedWidth must be a positive integer.");if(!Number.isInteger(Y.codedHeight)||Y.codedHeight<=0)throw TypeError("init.codedHeight must be a positive integer.");if(Y.rotation!==void 0&&![0,90,180,270].includes(Y.rotation))throw TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if(!Number.isFinite(Y.timestamp))throw TypeError("init.timestamp must be a number.");if(Y.duration!==void 0&&(!Number.isFinite(Y.duration)||Y.duration<0))throw TypeError("init.duration, when provided, must be a non-negative number.");this._data=H(Q).slice(),this._layout=Y.layout??ZQ(Y.format,Y.codedWidth,Y.codedHeight),this.format=Y.format,this.codedWidth=Y.codedWidth,this.codedHeight=Y.codedHeight,this.rotation=Y.rotation??0,this.timestamp=Y.timestamp,this.duration=Y.duration??0,this.colorSpace=new W(Y.colorSpace)}else if(typeof VideoFrame<"u"&&Q instanceof VideoFrame){if(Y?.rotation!==void 0&&![0,90,180,270].includes(Y.rotation))throw TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if(Y?.timestamp!==void 0&&!Number.isFinite(Y?.timestamp))throw TypeError("init.timestamp, when provided, must be a number.");if(Y?.duration!==void 0&&(!Number.isFinite(Y.duration)||Y.duration<0))throw TypeError("init.duration, when provided, must be a non-negative number.");this._data=Q,this._layout=null,this.format=Q.format,this.codedWidth=Q.displayWidth,this.codedHeight=Q.displayHeight,this.rotation=Y?.rotation??0,this.timestamp=Y?.timestamp??Q.timestamp/1e6,this.duration=Y?.duration??(Q.duration??0)/1e6,this.colorSpace=new W(Q.colorSpace)}else if(typeof HTMLImageElement<"u"&&Q instanceof HTMLImageElement||typeof SVGImageElement<"u"&&Q instanceof SVGImageElement||typeof ImageBitmap<"u"&&Q instanceof ImageBitmap||typeof HTMLVideoElement<"u"&&Q instanceof HTMLVideoElement||typeof HTMLCanvasElement<"u"&&Q instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&Q instanceof OffscreenCanvas){if(!Y||typeof Y!=="object")throw TypeError("init must be an object.");if(Y.rotation!==void 0&&![0,90,180,270].includes(Y.rotation))throw TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if(!Number.isFinite(Y.timestamp))throw TypeError("init.timestamp must be a number.");if(Y.duration!==void 0&&(!Number.isFinite(Y.duration)||Y.duration<0))throw TypeError("init.duration, when provided, must be a non-negative number.");if(typeof VideoFrame<"u")return new A(new VideoFrame(Q,{timestamp:Math.trunc(Y.timestamp*j),duration:Math.trunc((Y.duration??0)*j)||void 0}),Y);let J=0,U=0;if("naturalWidth"in Q)J=Q.naturalWidth,U=Q.naturalHeight;else if("videoWidth"in Q)J=Q.videoWidth,U=Q.videoHeight;else if("width"in Q)J=Number(Q.width),U=Number(Q.height);if(!J||!U)throw TypeError("Could not determine dimensions.");let $=new OffscreenCanvas(J,U),M=$.getContext("2d",{alpha:m(),willReadFrequently:!0});G(M),M.drawImage(Q,0,0),this._data=$,this._layout=null,this.format="RGBX",this.codedWidth=J,this.codedHeight=U,this.rotation=Y.rotation??0,this.timestamp=Y.timestamp,this.duration=Y.duration??0,this.colorSpace=new W({matrix:"rgb",primaries:"bt709",transfer:"iec61966-2-1",fullRange:!0})}else throw TypeError("Invalid data type: Must be a BufferSource or CanvasImageSource.");x?.register(this,{type:"video",data:this._data},this)}clone(){if(this._closed)throw Error("VideoSample is closed.");if(G(this._data!==null),V(this._data))return new A(this._data.clone(),{timestamp:this.timestamp,duration:this.duration,rotation:this.rotation});if(this._data instanceof Uint8Array)return G(this._layout),new A(this._data,{format:this.format,layout:this._layout,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.timestamp,duration:this.duration,colorSpace:this.colorSpace,rotation:this.rotation});return new A(this._data,{format:this.format,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.timestamp,duration:this.duration,colorSpace:this.colorSpace,rotation:this.rotation})}close(){if(this._closed)return;if(x?.unregister(this),V(this._data))this._data.close();else this._data=null;this._closed=!0}allocationSize(Q={}){if(qQ(Q),this._closed)throw Error("VideoSample is closed.");if((Q.format??this.format)===null)throw Error("Cannot get allocation size when format is null. Please manually provide an RGB pixel format in the options instead.");if(G(this._data!==null),!V(this._data)){if(Q.colorSpace||Q.format&&Q.format!==this.format||Q.layout||Q.rect){let Y=this.toVideoFrame(),J=Y.allocationSize(Q);return Y.close(),J}}if(V(this._data))return this._data.allocationSize(Q);if(this._data instanceof Uint8Array)return this._data.byteLength;return this.codedWidth*this.codedHeight*4}async copyTo(Q,Y={}){if(!f(Q))throw TypeError("destination must be an ArrayBuffer or an ArrayBuffer view.");if(this._closed)throw Error("VideoSample is closed.");if((Y.format??this.format)===null)throw Error("Cannot copy video sample data when format is null. Please manually provide an RGB pixel format in the options instead.");if(G(this._data!==null),!V(this._data)){if(Y.colorSpace||Y.format&&Y.format!==this.format||Y.layout||Y.rect){let J=this.toVideoFrame(),U=await J.copyTo(Q,Y);return J.close(),U}}if(V(this._data))return this._data.copyTo(Q,Y);else if(this._data instanceof Uint8Array)return G(this._layout),H(Q).set(this._data),this._layout;else{let U=this._data.getContext("2d");G(U);let $=U.getImageData(0,0,this.codedWidth,this.codedHeight);return H(Q).set($.data),[{offset:0,stride:4*this.codedWidth}]}}toVideoFrame(){if(this._closed)throw Error("VideoSample is closed.");if(G(this._data!==null),V(this._data))return new VideoFrame(this._data,{timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0});if(this._data instanceof Uint8Array)return new VideoFrame(this._data,{format:this.format,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0,colorSpace:this.colorSpace});return new VideoFrame(this._data,{timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0})}draw(Q,Y,J,U,$,M,K,I,k){let q=0,Z=0,z=this.displayWidth,L=this.displayHeight,N=0,P=0,X=this.displayWidth,T=this.displayHeight;if(M!==void 0)if(q=Y,Z=J,z=U,L=$,N=M,P=K,I!==void 0)X=I,T=k;else X=z,T=L;else if(N=Y,P=J,U!==void 0)X=U,T=$;if(!(typeof CanvasRenderingContext2D<"u"&&Q instanceof CanvasRenderingContext2D||typeof OffscreenCanvasRenderingContext2D<"u"&&Q instanceof OffscreenCanvasRenderingContext2D))throw TypeError("context must be a CanvasRenderingContext2D or OffscreenCanvasRenderingContext2D.");if(!Number.isFinite(q))throw TypeError("sx must be a number.");if(!Number.isFinite(Z))throw TypeError("sy must be a number.");if(!Number.isFinite(z)||z<0)throw TypeError("sWidth must be a non-negative number.");if(!Number.isFinite(L)||L<0)throw TypeError("sHeight must be a non-negative number.");if(!Number.isFinite(N))throw TypeError("dx must be a number.");if(!Number.isFinite(P))throw TypeError("dy must be a number.");if(!Number.isFinite(X)||X<0)throw TypeError("dWidth must be a non-negative number.");if(!Number.isFinite(T)||T<0)throw TypeError("dHeight must be a non-negative number.");if(this._closed)throw Error("VideoSample is closed.");({sx:q,sy:Z,sWidth:z,sHeight:L}=this._rotateSourceRegion(q,Z,z,L,this.rotation));let _=this.toCanvasImageSource();Q.save();let R=N+X/2,t=P+T/2;Q.translate(R,t),Q.rotate(this.rotation*Math.PI/180);let v=this.rotation%180===0?1:X/T;Q.scale(1/v,v),Q.drawImage(_,q,Z,z,L,-X/2,-T/2,X,T),Q.restore()}drawWithFit(Q,Y){if(!(typeof CanvasRenderingContext2D<"u"&&Q instanceof CanvasRenderingContext2D||typeof OffscreenCanvasRenderingContext2D<"u"&&Q instanceof OffscreenCanvasRenderingContext2D))throw TypeError("context must be a CanvasRenderingContext2D or OffscreenCanvasRenderingContext2D.");if(!Y||typeof Y!=="object")throw TypeError("options must be an object.");if(!["fill","contain","cover"].includes(Y.fit))throw TypeError("options.fit must be 'fill', 'contain', or 'cover'.");if(Y.rotation!==void 0&&![0,90,180,270].includes(Y.rotation))throw TypeError("options.rotation, when provided, must be 0, 90, 180, or 270.");if(Y.crop!==void 0)KQ(Y.crop,"options.");let J=Q.canvas.width,U=Q.canvas.height,$=Y.rotation??this.rotation,[M,K]=$%180===0?[this.codedWidth,this.codedHeight]:[this.codedHeight,this.codedWidth];if(Y.crop)MQ(Y.crop,M,K);let I,k,q,Z,{sx:z,sy:L,sWidth:N,sHeight:P}=this._rotateSourceRegion(Y.crop?.left??0,Y.crop?.top??0,Y.crop?.width??M,Y.crop?.height??K,$);if(Y.fit==="fill")I=0,k=0,q=J,Z=U;else{let[T,_]=Y.crop?[Y.crop.width,Y.crop.height]:[M,K],R=Y.fit==="contain"?Math.min(J/T,U/_):Math.max(J/T,U/_);q=T*R,Z=_*R,I=(J-q)/2,k=(U-Z)/2}Q.save();let X=$%180===0?1:q/Z;Q.translate(J/2,U/2),Q.rotate($*Math.PI/180),Q.scale(1/X,X),Q.translate(-J/2,-U/2),Q.drawImage(this.toCanvasImageSource(),z,L,N,P,I,k,q,Z),Q.restore()}_rotateSourceRegion(Q,Y,J,U,$){if($===90)[Q,Y,J,U]=[Y,this.codedHeight-Q-J,U,J];else if($===180)[Q,Y]=[this.codedWidth-Q-J,this.codedHeight-Y-U];else if($===270)[Q,Y,J,U]=[this.codedWidth-Y-U,Q,U,J];return{sx:Q,sy:Y,sWidth:J,sHeight:U}}toCanvasImageSource(){if(this._closed)throw Error("VideoSample is closed.");if(G(this._data!==null),this._data instanceof Uint8Array){let Q=this.toVideoFrame();return queueMicrotask(()=>Q.close()),Q}return this._data}setRotation(Q){if(![0,90,180,270].includes(Q))throw TypeError("newRotation must be 0, 90, 180, or 270.");this.rotation=Q}setTimestamp(Q){if(!Number.isFinite(Q))throw TypeError("newTimestamp must be a number.");this.timestamp=Q}setDuration(Q){if(!Number.isFinite(Q)||Q<0)throw TypeError("newDuration must be a non-negative number.");this.duration=Q}[Symbol.dispose](){this.close()}}class W{primaries;transfer;matrix;fullRange;constructor(Q){this.primaries=Q?.primaries??null,this.transfer=Q?.transfer??null,this.matrix=Q?.matrix??null,this.fullRange=Q?.fullRange??null}toJSON(){return{primaries:this.primaries,transfer:this.transfer,matrix:this.matrix,fullRange:this.fullRange}}}var V=(Q)=>{return typeof VideoFrame<"u"&&Q instanceof VideoFrame},MQ=(Q,Y,J)=>{Q.left=Math.min(Q.left,Y),Q.top=Math.min(Q.top,J),Q.width=Math.min(Q.width,Y-Q.left),Q.height=Math.min(Q.height,J-Q.top),G(Q.width>=0),G(Q.height>=0)},KQ=(Q,Y)=>{if(!Q||typeof Q!=="object")throw TypeError(Y+"crop, when provided, must be an object.");if(!Number.isInteger(Q.left)||Q.left<0)throw TypeError(Y+"crop.left must be a non-negative integer.");if(!Number.isInteger(Q.top)||Q.top<0)throw TypeError(Y+"crop.top must be a non-negative integer.");if(!Number.isInteger(Q.width)||Q.width<0)throw TypeError(Y+"crop.width must be a non-negative integer.");if(!Number.isInteger(Q.height)||Q.height<0)throw TypeError(Y+"crop.height must be a non-negative integer.")},qQ=(Q)=>{if(!Q||typeof Q!=="object")throw TypeError("options must be an object.");if(Q.colorSpace!==void 0&&!["display-p3","srgb"].includes(Q.colorSpace))throw TypeError("options.colorSpace, when provided, must be 'display-p3' or 'srgb'.");if(Q.format!==void 0&&typeof Q.format!=="string")throw TypeError("options.format, when provided, must be a string.");if(Q.layout!==void 0){if(!Array.isArray(Q.layout))throw TypeError("options.layout, when provided, must be an array.");for(let Y of Q.layout){if(!Y||typeof Y!=="object")throw TypeError("Each entry in options.layout must be an object.");if(!Number.isInteger(Y.offset)||Y.offset<0)throw TypeError("plane.offset must be a non-negative integer.");if(!Number.isInteger(Y.stride)||Y.stride<0)throw TypeError("plane.stride must be a non-negative integer.")}}if(Q.rect!==void 0){if(!Q.rect||typeof Q.rect!=="object")throw TypeError("options.rect, when provided, must be an object.");if(Q.rect.x!==void 0&&(!Number.isInteger(Q.rect.x)||Q.rect.x<0))throw TypeError("options.rect.x, when provided, must be a non-negative integer.");if(Q.rect.y!==void 0&&(!Number.isInteger(Q.rect.y)||Q.rect.y<0))throw TypeError("options.rect.y, when provided, must be a non-negative integer.");if(Q.rect.width!==void 0&&(!Number.isInteger(Q.rect.width)||Q.rect.width<0))throw TypeError("options.rect.width, when provided, must be a non-negative integer.");if(Q.rect.height!==void 0&&(!Number.isInteger(Q.rect.height)||Q.rect.height<0))throw TypeError("options.rect.height, when provided, must be a non-negative integer.")}},ZQ=(Q,Y,J)=>{let U=TQ(Q),$=[],M=0;for(let K of U){let I=Math.ceil(Y/K.widthDivisor),k=Math.ceil(J/K.heightDivisor),q=I*K.sampleBytes,Z=q*k;$.push({offset:M,stride:q}),M+=Z}return $},TQ=(Q)=>{let Y=(J,U,$,M,K)=>{let I=[{sampleBytes:J,widthDivisor:1,heightDivisor:1},{sampleBytes:U,widthDivisor:$,heightDivisor:M},{sampleBytes:U,widthDivisor:$,heightDivisor:M}];if(K)I.push({sampleBytes:J,widthDivisor:1,heightDivisor:1});return I};switch(Q){case"I420":return Y(1,1,2,2,!1);case"I420P10":case"I420P12":return Y(2,2,2,2,!1);case"I420A":return Y(1,1,2,2,!0);case"I420AP10":case"I420AP12":return Y(2,2,2,2,!0);case"I422":return Y(1,1,2,1,!1);case"I422P10":case"I422P12":return Y(2,2,2,1,!1);case"I422A":return Y(1,1,2,1,!0);case"I422AP10":case"I422AP12":return Y(2,2,2,1,!0);case"I444":return Y(1,1,1,1,!1);case"I444P10":case"I444P12":return Y(2,2,1,1,!1);case"I444A":return Y(1,1,1,1,!0);case"I444AP10":case"I444AP12":return Y(2,2,1,1,!0);case"NV12":return[{sampleBytes:1,widthDivisor:1,heightDivisor:1},{sampleBytes:2,widthDivisor:2,heightDivisor:2}];case"RGBA":case"RGBX":case"BGRA":case"BGRX":return[{sampleBytes:4,widthDivisor:1,heightDivisor:1}];default:h(Q),G(!1)}};/*!
|
|
33
|
+
* Copyright (c) 2025-present, Vanilagy and contributors
|
|
34
|
+
*
|
|
35
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
36
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
37
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
38
|
+
*//*!
|
|
39
|
+
* Copyright (c) 2025-present, Vanilagy and contributors (Wiedy Mi)
|
|
40
|
+
*
|
|
41
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
42
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
43
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
44
|
+
*/var GQ=new URL("./decode.worker.ts",import.meta.url),XQ=new URL("./encode.worker.ts",import.meta.url),n=(Q)=>{return new Worker(Q,{type:"module"})};class a extends E{worker=null;nextMessageId=0;pendingMessages=new Map;static supports(Q,Y){return Q==="mpeg4"}async init(){this.worker=n(GQ);let Q=(Y)=>{let J=Y.data,U=this.pendingMessages.get(J.id);if(B(U!==void 0),this.pendingMessages.delete(J.id),J.success)U.resolve(J.data);else U.reject(J.error)};this.worker.addEventListener("message",Q),await this.sendCommand({type:"init",data:{width:this.config.codedWidth,height:this.config.codedHeight}})}async decode(Q,Y){let J=Q.data.slice().buffer,U=await this.sendCommand({type:"decode",data:{frameData:J}},[J]);if(!U||!("yuvData"in U))return;let $=new VideoFrame(new Uint8Array(U.yuvData),{format:"I420",codedWidth:U.width,codedHeight:U.height,timestamp:Q.timestamp*1e6}),M=new A($);this.onSample(M)}async flush(){await this.sendCommand({type:"flush"})}close(){if(this.worker)this.sendCommand({type:"close"}),this.worker.terminate()}sendCommand(Q,Y){return new Promise((J,U)=>{let $=this.nextMessageId++;if(this.pendingMessages.set($,{resolve:J,reject:U}),B(this.worker!==null),Y)this.worker.postMessage({id:$,command:Q},Y);else this.worker.postMessage({id:$,command:Q})})}}class i extends F{worker=null;nextMessageId=0;pendingMessages=new Map;frameCount=0;static supports(Q,Y){return Q==="mpeg4"}async init(){this.worker=n(XQ);let Q=(U)=>{let $=U.data,M=this.pendingMessages.get($.id);if(B(M!==void 0),this.pendingMessages.delete($.id),$.success)M.resolve($.data);else M.reject($.error)};this.worker.addEventListener("message",Q);let Y=Math.round((this.config.framerate??30)*1000),J=1000;await this.sendCommand({type:"init",data:{width:this.config.width,height:this.config.height,bitrate:this.config.bitrate??2000000,fpsNum:Y,fpsDen:J}})}async encode(Q,Y){let J=Q.codedWidth*Q.codedHeight*3/2,U=new ArrayBuffer(J),$=new Uint8Array(U);await Q.copyTo($);let M=await this.sendCommand({type:"encode",data:{yuvData:U,forceKeyframe:Y.keyFrame??!1}},[U]);B(M&&"encodedData"in M);let K=new S(new Uint8Array(M.encodedData),Y.keyFrame?"key":"delta",Q.timestamp,Q.duration,this.frameCount++);this.onPacket(K,this.frameCount===1?{decoderConfig:{codec:"mpeg4",codedWidth:this.config.width,codedHeight:this.config.height}}:void 0)}async flush(){}close(){if(this.worker)this.sendCommand({type:"close"}),this.worker.terminate()}sendCommand(Q,Y){return new Promise((J,U)=>{let $=this.nextMessageId++;if(this.pendingMessages.set($,{resolve:J,reject:U}),B(this.worker!==null),Y)this.worker.postMessage({id:$,command:Q},Y);else this.worker.postMessage({id:$,command:Q})})}}var OQ=()=>{b(a)},CQ=()=>{g(i)};function B(Q){if(!Q)throw Error("Assertion failed.")}export{CQ as registerMpeg4Encoder,OQ as registerMpeg4Decoder,i as Mpeg4Encoder,a as Mpeg4Decoder};
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,54 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kenzuya/mediabunny",
|
|
3
3
|
"author": "Vanilagy",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.28.6",
|
|
5
5
|
"description": "Pure TypeScript media toolkit for reading, writing, and converting media files, directly in the browser.",
|
|
6
6
|
"type": "module",
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"packages/*"
|
|
10
|
-
],
|
|
11
|
-
"main": "./dist/bundles/mediabunny.cjs",
|
|
12
|
-
"module": "./dist/modules/src/index.js",
|
|
7
|
+
"main": "./dist/bundles/mediabunny.js",
|
|
8
|
+
"module": "./dist/bundles/mediabunny.js",
|
|
13
9
|
"types": "./dist/modules/src/index.d.ts",
|
|
14
10
|
"exports": {
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/modules/src/index.d.ts",
|
|
13
|
+
"import": "./dist/bundles/mediabunny.js",
|
|
14
|
+
"default": "./dist/bundles/mediabunny.js"
|
|
15
|
+
},
|
|
16
|
+
"./package.json": "./package.json"
|
|
18
17
|
},
|
|
19
18
|
"files": [
|
|
20
19
|
"README.md",
|
|
21
20
|
"package.json",
|
|
22
21
|
"LICENSE",
|
|
23
|
-
"dist"
|
|
24
|
-
"src"
|
|
22
|
+
"dist"
|
|
25
23
|
],
|
|
26
24
|
"browser": {
|
|
27
|
-
"./dist/modules/src/node.js": false,
|
|
28
25
|
"./src/node.ts": false,
|
|
29
26
|
"node:fs/promises": false
|
|
30
27
|
},
|
|
31
28
|
"sideEffects": false,
|
|
32
29
|
"scripts": {
|
|
33
|
-
"build": "
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"test-browser": "npm run test browser/",
|
|
39
|
-
"check": "rm -rf dist/modules && tsc -p src && tsc -p packages/mp3-encoder/src --noEmit && tsc -p tsconfig.vitest.json --noEmit && tsc -p scripts --noEmit && tsc -p tsconfig.vite.json --noEmit",
|
|
40
|
-
"check-docblocks": "tsx scripts/check-docblocks.ts dist/mediabunny.d.ts",
|
|
41
|
-
"docs:dev": "vitepress dev docs",
|
|
42
|
-
"docs:build": "npm run build && npm run docs:generate && vitepress build docs && npm run examples:build && cp dist/mediabunny.d.ts dist-docs/",
|
|
43
|
-
"docs:preview": "vitepress preview docs",
|
|
44
|
-
"docs:generate": "tsx scripts/generate-api-docs.ts src/index.ts packages/mp3-encoder/src/index.ts docs/api-config.json",
|
|
45
|
-
"dev": "vite",
|
|
46
|
-
"examples:build": "vite build",
|
|
47
|
-
"fix-build-import-paths": "tsx scripts/add-import-extensions.ts",
|
|
48
|
-
"append-namespace": "echo 'export as namespace Mediabunny;' >> dist/mediabunny.d.ts",
|
|
49
|
-
"bump-patch": "npm version patch --no-git-tag-version --workspaces --include-workspace-root",
|
|
50
|
-
"bump-minor": "npm version minor --no-git-tag-version --workspaces --include-workspace-root",
|
|
51
|
-
"bump-major": "npm version major --no-git-tag-version --workspaces --include-workspace-root"
|
|
30
|
+
"build": "bun run build.ts",
|
|
31
|
+
"check-types": "tsc --noEmit",
|
|
32
|
+
"check-docblocks": "bun run scripts/check-docblocks.ts dist/mediabunny.d.ts",
|
|
33
|
+
"fix-build-import-paths": "bun run scripts/add-import-extensions.ts",
|
|
34
|
+
"append-namespace": "echo 'export as namespace Mediabunny;' >> dist/mediabunny.d.ts"
|
|
52
35
|
},
|
|
53
36
|
"license": "MPL-2.0",
|
|
54
37
|
"repository": {
|
|
@@ -68,32 +51,10 @@
|
|
|
68
51
|
"@types/dom-webcodecs": "0.1.13"
|
|
69
52
|
},
|
|
70
53
|
"devDependencies": {
|
|
71
|
-
"@
|
|
72
|
-
"@
|
|
73
|
-
"@fontsource/dm-mono": "^5.2.6",
|
|
74
|
-
"@microsoft/api-extractor": "^7.52.1",
|
|
75
|
-
"@stylistic/eslint-plugin": "^4.2.0",
|
|
76
|
-
"@tailwindcss/vite": "^4.1.7",
|
|
77
|
-
"@types/markdown-it-footnote": "^3.0.4",
|
|
54
|
+
"@types/bun": "^1.3.3",
|
|
55
|
+
"@types/emscripten": "^1.40.1",
|
|
78
56
|
"@types/node": "^22.13.10",
|
|
79
|
-
"
|
|
80
|
-
"esbuild-plugin-external-global": "^1.0.1",
|
|
81
|
-
"eslint": "^9.22.0",
|
|
82
|
-
"find-cache-dir": "^5.0.0",
|
|
83
|
-
"markdown-it-footnote": "^4.0.0",
|
|
84
|
-
"markdown-it-mathjax3": "^4.3.2",
|
|
85
|
-
"mermaid": "^11.6.0",
|
|
86
|
-
"tailwindcss": "^4.1.7",
|
|
87
|
-
"tsx": "^4.19.4",
|
|
88
|
-
"typescript": "^5.8.2",
|
|
89
|
-
"typescript-eslint": "^8.26.1",
|
|
90
|
-
"vite": "^6.3.5",
|
|
91
|
-
"vitepress": "^1.6.3",
|
|
92
|
-
"vitepress-plugin-llms": "^1.5.1",
|
|
93
|
-
"vitepress-plugin-mermaid": "^2.0.17",
|
|
94
|
-
"vitest": "3.2.4",
|
|
95
|
-
"@vitest/browser": "3.2.4",
|
|
96
|
-
"webdriverio": "9.19.2"
|
|
57
|
+
"typescript": "^5.8.2"
|
|
97
58
|
},
|
|
98
59
|
"keywords": [
|
|
99
60
|
"media",
|