diff --git a/web/src/components/misc/DropReceiver.svelte b/web/src/components/misc/DropReceiver.svelte index dec3f1a0..a653067d 100644 --- a/web/src/components/misc/DropReceiver.svelte +++ b/web/src/components/misc/DropReceiver.svelte @@ -3,7 +3,7 @@ export let classes = ""; export let draggedOver = false; - export let file: File; + export let file: File | undefined; const dropHandler = async (ev: DragEvent) => { draggedOver = false; diff --git a/web/src/components/misc/FileReceiver.svelte b/web/src/components/misc/FileReceiver.svelte index 7310afa7..7f570186 100644 --- a/web/src/components/misc/FileReceiver.svelte +++ b/web/src/components/misc/FileReceiver.svelte @@ -4,7 +4,7 @@ import Meowbalt from "$components/misc/Meowbalt.svelte"; import IconFileUpload from "@tabler/icons-svelte/IconFileUpload.svelte"; - export let file: File; + export let file: File | undefined; export let draggedOver = false; export let acceptTypes: string[]; export let acceptExtensions: string[]; diff --git a/web/src/routes/remux/+page.svelte b/web/src/routes/remux/+page.svelte index 17b6abeb..2c6a701d 100644 --- a/web/src/routes/remux/+page.svelte +++ b/web/src/routes/remux/+page.svelte @@ -4,25 +4,35 @@ import { t } from "$lib/i18n/translations"; import DropReceiver from "$components/misc/DropReceiver.svelte"; - import OpenFileButton from "$components/misc/FileReceiver.svelte"; + import FileReceiver from "$components/misc/FileReceiver.svelte"; let draggedOver = false; - let file: File; + let file: File | undefined; + + let processing = false; const render = async () => { + if (!file || processing) return; + const ff = new LibAVWrapper(); await ff.init(); + processing = true; + const render = await ff.render({ blob: file, args: ["-c", "copy"], }); + processing = false; + if (render) { openURL(URL.createObjectURL(render)); } else { console.log("not a valid file"); } + + file = undefined; }; $: if (file) { @@ -31,8 +41,8 @@ - - + + + + {#if processing} + processing... + {:else} + done! + {/if} +