web/libav: try to guess type from filename if browser fails

This commit is contained in:
dumbmoron 2024-08-17 14:07:07 +00:00
parent 911f283b78
commit a4d57f175e
No known key found for this signature in database

View file

@ -6,9 +6,10 @@
import DropReceiver from "$components/misc/DropReceiver.svelte"; import DropReceiver from "$components/misc/DropReceiver.svelte";
import FileReceiver from "$components/misc/FileReceiver.svelte"; import FileReceiver from "$components/misc/FileReceiver.svelte";
import { createDialog } from "$lib/dialogs"; import { createDialog } from "$lib/dialogs";
import mime from "mime";
let draggedOver = false; let draggedOver = false;
let file: File | undefined; let file: File | Blob | undefined;
let totalDuration: number | undefined; let totalDuration: number | undefined;
let processedDuration: number | undefined; let processedDuration: number | undefined;
@ -66,6 +67,12 @@
totalDuration = Number(file_info.format.duration); totalDuration = Number(file_info.format.duration);
if (file instanceof File && !file.type) {
file = new Blob([ file ], {
type: mime.getType(file.name) ?? undefined
});
}
const render = await ff.render({ const render = await ff.render({
blob: file, blob: file,
args: ['-c', 'copy', '-map', '0'] args: ['-c', 'copy', '-map', '0']