From 7d10ab765e9035e6cd716dfcaf2411a08ca74815 Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Sat, 17 Aug 2024 13:26:30 +0000 Subject: [PATCH] web/remux: override mp3 extension from mime type --- web/src/lib/libav.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web/src/lib/libav.ts b/web/src/lib/libav.ts index bb284b54..819ceaaf 100644 --- a/web/src/lib/libav.ts +++ b/web/src/lib/libav.ts @@ -66,8 +66,15 @@ export default class LibAVWrapper { if (!this.libav) throw new Error("LibAV wasn't initialized"); const libav = await this.libav; const inputKind = blob.type.split("/")[0]; - const inputExtension = mime.getExtension(blob.type); + let inputExtension; + const extensions = mime.getAllExtensions(blob.type); + if (extensions?.has('mp3')) { + inputExtension = 'mp3'; + } else if (extensions) { + inputExtension = [...extensions][0]; + } + console.log(extensions, blob); if (inputKind !== "video" && inputKind !== "audio") return; if (!inputExtension) return;