web/remux: override mp3 extension from mime type

This commit is contained in:
dumbmoron 2024-08-17 13:26:30 +00:00
parent d446dfd87e
commit 7d10ab765e
No known key found for this signature in database

View file

@ -66,8 +66,15 @@ export default class LibAVWrapper {
if (!this.libav) throw new Error("LibAV wasn't initialized"); if (!this.libav) throw new Error("LibAV wasn't initialized");
const libav = await this.libav; const libav = await this.libav;
const inputKind = blob.type.split("/")[0]; 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 (inputKind !== "video" && inputKind !== "audio") return;
if (!inputExtension) return; if (!inputExtension) return;