webcodecs-utils 0.2.3 → 0.2.4
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/index.cjs +20 -20
- package/dist/index.js +32 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -486,6 +486,17 @@ function En(t) {
|
|
|
486
486
|
}
|
|
487
487
|
return e;
|
|
488
488
|
}
|
|
489
|
+
async function R1(t) {
|
|
490
|
+
if (t.kind !== "audio")
|
|
491
|
+
throw new Error("Track must be an audio track");
|
|
492
|
+
const e = t.getSettings();
|
|
493
|
+
if (e.sampleRate)
|
|
494
|
+
return e.sampleRate;
|
|
495
|
+
const i = new AudioContext(), n = new MediaStreamAudioSourceNode(i, {
|
|
496
|
+
mediaStream: new MediaStream([t])
|
|
497
|
+
}), c = i.sampleRate;
|
|
498
|
+
return n.disconnect(), await i.close(), c;
|
|
499
|
+
}
|
|
489
500
|
function bi(t) {
|
|
490
501
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
491
502
|
}
|
|
@@ -9779,7 +9790,7 @@ cn(dn, "MPEGDecoderWebWorker");
|
|
|
9779
9790
|
globalThis.MPEGMode = Nn;
|
|
9780
9791
|
globalThis.Lame = ia;
|
|
9781
9792
|
globalThis.BitStream = Or;
|
|
9782
|
-
class
|
|
9793
|
+
class T1 {
|
|
9783
9794
|
/**
|
|
9784
9795
|
* Create a new MP3Encoder.
|
|
9785
9796
|
*
|
|
@@ -9845,7 +9856,7 @@ class R1 {
|
|
|
9845
9856
|
return this.encodedData.reduce((e, i) => e + i.length, 0);
|
|
9846
9857
|
}
|
|
9847
9858
|
}
|
|
9848
|
-
class
|
|
9859
|
+
class W1 {
|
|
9849
9860
|
/**
|
|
9850
9861
|
* Create a new MP3Decoder.
|
|
9851
9862
|
*
|
|
@@ -10078,7 +10089,7 @@ function ba(t, e, i, n, c) {
|
|
|
10078
10089
|
o.start(), r().catch(S);
|
|
10079
10090
|
});
|
|
10080
10091
|
}
|
|
10081
|
-
class
|
|
10092
|
+
class L1 {
|
|
10082
10093
|
/**
|
|
10083
10094
|
* Create a new MP4Demuxer instance.
|
|
10084
10095
|
* @param file - The MP4 file to demux
|
|
@@ -10150,7 +10161,7 @@ class W1 {
|
|
|
10150
10161
|
return this.mp4Data.info;
|
|
10151
10162
|
}
|
|
10152
10163
|
}
|
|
10153
|
-
class
|
|
10164
|
+
class x1 {
|
|
10154
10165
|
/**
|
|
10155
10166
|
* Create a new InMemoryStorage instance
|
|
10156
10167
|
* @param chunkSize Size of each chunk in bytes (default: 10MB)
|
|
@@ -10302,7 +10313,7 @@ class mn {
|
|
|
10302
10313
|
}
|
|
10303
10314
|
}
|
|
10304
10315
|
self.MediaStreamTrackProcessor || (self.MediaStreamTrackProcessor = mn);
|
|
10305
|
-
const
|
|
10316
|
+
const H1 = self.MediaStreamTrackProcessor || mn;
|
|
10306
10317
|
var ya = Object.defineProperty, fa = (t, e, i) => e in t ? ya(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i, oi = (t, e, i) => (fa(t, typeof e != "symbol" ? e + "" : e, i), i), I0 = /* @__PURE__ */ ((t) => (t[t.AVMEDIA_TYPE_UNKNOWN = -1] = "AVMEDIA_TYPE_UNKNOWN", t[t.AVMEDIA_TYPE_VIDEO = 0] = "AVMEDIA_TYPE_VIDEO", t[t.AVMEDIA_TYPE_AUDIO = 1] = "AVMEDIA_TYPE_AUDIO", t[t.AVMEDIA_TYPE_DATA = 2] = "AVMEDIA_TYPE_DATA", t[t.AVMEDIA_TYPE_SUBTITLE = 3] = "AVMEDIA_TYPE_SUBTITLE", t[t.AVMEDIA_TYPE_ATTACHMENT = 4] = "AVMEDIA_TYPE_ATTACHMENT", t[t.AVMEDIA_TYPE_NB = 5] = "AVMEDIA_TYPE_NB", t))(I0 || {}), di = /* @__PURE__ */ ((t) => (t[t.AVSEEK_FLAG_BACKWARD = 1] = "AVSEEK_FLAG_BACKWARD", t[t.AVSEEK_FLAG_BYTE = 2] = "AVSEEK_FLAG_BYTE", t[t.AVSEEK_FLAG_ANY = 4] = "AVSEEK_FLAG_ANY", t[t.AVSEEK_FLAG_FRAME = 8] = "AVSEEK_FLAG_FRAME", t))(di || {}), rt = /* @__PURE__ */ ((t) => (t.WasmWorkerLoaded = "WasmWorkerLoaded", t.WASMRuntimeInitialized = "WASMRuntimeInitialized", t.LoadWASM = "LoadWASM", t.GetAVPacket = "GetAVPacket", t.GetAVPackets = "GetAVPackets", t.GetAVStream = "GetAVStream", t.GetAVStreams = "GetAVStreams", t.GetMediaInfo = "GetMediaInfo", t.ReadAVPacket = "ReadAVPacket", t.AVPacketStream = "AVPacketStream", t.ReadNextAVPacket = "ReadNextAVPacket", t.StopReadAVPacket = "StopReadAVPacket", t.SetAVLogLevel = "SetAVLogLevel", t))(rt || {});
|
|
10307
10318
|
const un = "video", Za = "audio", Xa = "subtitle", ws = {
|
|
10308
10319
|
VIDEO: un
|
|
@@ -10611,7 +10622,7 @@ function Zi() {
|
|
|
10611
10622
|
"⚠️ Demo/Learning Function: This utility is intended for demos and learning purposes only. For production use, please use a proper demuxing library like MediaBunny (https://mediabunny.dev/) or web-demuxer (https://github.com/bilibili/web-demuxer) directly."
|
|
10612
10623
|
), ks = !0);
|
|
10613
10624
|
}
|
|
10614
|
-
async function
|
|
10625
|
+
async function Y1(t) {
|
|
10615
10626
|
Zi();
|
|
10616
10627
|
const e = new fi({
|
|
10617
10628
|
wasmFilePath: "https://cdn.jsdelivr.net/npm/web-demuxer@latest/dist/wasm-files/web-demuxer.wasm"
|
|
@@ -10625,7 +10636,7 @@ async function H1(t) {
|
|
|
10625
10636
|
});
|
|
10626
10637
|
});
|
|
10627
10638
|
}
|
|
10628
|
-
async function
|
|
10639
|
+
async function w1(t) {
|
|
10629
10640
|
Zi();
|
|
10630
10641
|
const e = new fi({
|
|
10631
10642
|
wasmFilePath: "https://cdn.jsdelivr.net/npm/web-demuxer@latest/dist/wasm-files/web-demuxer.wasm"
|
|
@@ -10648,7 +10659,7 @@ async function Y1(t) {
|
|
|
10648
10659
|
config: m
|
|
10649
10660
|
};
|
|
10650
10661
|
}
|
|
10651
|
-
async function
|
|
10662
|
+
async function K1(t) {
|
|
10652
10663
|
Zi();
|
|
10653
10664
|
const e = new fi({
|
|
10654
10665
|
wasmFilePath: "https://cdn.jsdelivr.net/npm/web-demuxer@latest/dist/wasm-files/web-demuxer.wasm"
|
|
@@ -10672,7 +10683,7 @@ async function w1(t) {
|
|
|
10672
10683
|
config: m
|
|
10673
10684
|
};
|
|
10674
10685
|
}
|
|
10675
|
-
async function
|
|
10686
|
+
async function M1(t) {
|
|
10676
10687
|
Zi();
|
|
10677
10688
|
const e = new fi({
|
|
10678
10689
|
wasmFilePath: "https://cdn.jsdelivr.net/npm/web-demuxer@latest/dist/wasm-files/web-demuxer.wasm"
|
|
@@ -13809,7 +13820,7 @@ class _1 {
|
|
|
13809
13820
|
})();
|
|
13810
13821
|
}
|
|
13811
13822
|
}
|
|
13812
|
-
class
|
|
13823
|
+
class k1 {
|
|
13813
13824
|
/**
|
|
13814
13825
|
* Create a new ExampleMuxer.
|
|
13815
13826
|
*
|
|
@@ -13846,18 +13857,19 @@ class M1 {
|
|
|
13846
13857
|
}
|
|
13847
13858
|
}
|
|
13848
13859
|
export {
|
|
13849
|
-
|
|
13860
|
+
k1 as ExampleMuxer,
|
|
13850
13861
|
V1 as GPUFrameRenderer,
|
|
13851
|
-
|
|
13852
|
-
|
|
13853
|
-
|
|
13854
|
-
|
|
13855
|
-
|
|
13856
|
-
|
|
13857
|
-
|
|
13862
|
+
x1 as InMemoryStorage,
|
|
13863
|
+
W1 as MP3Decoder,
|
|
13864
|
+
T1 as MP3Encoder,
|
|
13865
|
+
L1 as MP4Demuxer,
|
|
13866
|
+
H1 as MediaStreamTrackProcessor,
|
|
13867
|
+
w1 as demuxAudio,
|
|
13868
|
+
K1 as demuxVideo,
|
|
13858
13869
|
En as extractChannels,
|
|
13859
|
-
|
|
13870
|
+
M1 as getAudioChunks,
|
|
13860
13871
|
v1 as getBitrate,
|
|
13861
13872
|
I1 as getCodecString,
|
|
13862
|
-
|
|
13873
|
+
R1 as getSampleRate,
|
|
13874
|
+
Y1 as getVideoChunks
|
|
13863
13875
|
};
|