diff --git a/web/src/routes/remux/+page.svelte b/web/src/routes/remux/+page.svelte index fd223847..6f9d075d 100644 --- a/web/src/routes/remux/+page.svelte +++ b/web/src/routes/remux/+page.svelte @@ -2,13 +2,12 @@ import mime from "mime"; import LibAVWrapper from "$lib/libav/remux"; - import { onDestroy } from "svelte"; + import { onDestroy, onMount } from "svelte"; import { beforeNavigate, goto } from "$app/navigation"; import { t } from "$lib/i18n/translations"; import { createDialog } from "$lib/dialogs"; import { downloadFile } from "$lib/download"; - import { browser } from "$app/environment"; import Skeleton from "$components/misc/Skeleton.svelte"; import DropReceiver from "$components/misc/DropReceiver.svelte"; @@ -53,13 +52,9 @@ } }); - if (browser) { - ff.init(); - } - const render = async () => { if (!file || processing) return; - await ff.init(); + ff.init(); let dialogOpened; try { @@ -199,6 +194,7 @@ render(); } + onMount(() => ff.init()); onDestroy(() => ff.terminate()); diff --git a/web/src/routes/shrink/+page.svelte b/web/src/routes/shrink/+page.svelte index 5ed40d8a..67e4de2e 100644 --- a/web/src/routes/shrink/+page.svelte +++ b/web/src/routes/shrink/+page.svelte @@ -7,16 +7,12 @@ import DropReceiver from "$components/misc/DropReceiver.svelte"; import FileReceiver from "$components/misc/FileReceiver.svelte"; import type { StreamInfo } from "$lib/types/libav"; - import { onDestroy } from "svelte"; + import { onDestroy, onMount } from "svelte"; let file: File | undefined; let streamInfo: StreamInfo[] | undefined; const ff = new LibAVWrapper(); - if (browser) { - ff.init(); - } - const render = async () => { if (!file) return; await ff.init(); @@ -58,6 +54,7 @@ pseudolink.click(); }; + onMount(() => ff.init()); onDestroy(async () => { if (browser) { await ff.cleanup();