Initial Commit

This commit is contained in:
2026-05-27 23:47:53 +01:00
parent fbc70f96e6
commit 9b28db724f
18103 changed files with 1600554 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import { createWasmCodec } from "./wasm-base.js";
function webmMagic(bytes: Uint8Array): boolean {
// EBML header: 0x1A 0x45 0xDF 0xA3
if (bytes.byteLength < 4) return false;
return (
bytes[0] === 0x1a &&
bytes[1] === 0x45 &&
bytes[2] === 0xdf &&
bytes[3] === 0xa3
);
}
/** Lazy WebM (audio track) codec backed by `@audio/decode-webm`. Decode-only. */
export const WebMCodec = createWasmCodec({
name: "webm",
extensions: ["webm"],
mimeTypes: ["audio/webm"],
module: "@audio/decode-webm",
magic: webmMagic,
supportsEncode: false,
load: () =>
// @ts-expect-error optional dependency resolved at runtime
import("@audio/decode-webm"),
});