web/remux,convert: shut down libav.js on page exit

This commit is contained in:
dumbmoron 2024-08-26 19:19:52 +00:00
parent 2aece4a746
commit f36088b48d
No known key found for this signature in database
2 changed files with 10 additions and 2 deletions

View file

@ -4,6 +4,7 @@
import DropReceiver from "$components/misc/DropReceiver.svelte";
import FileReceiver from "$components/misc/FileReceiver.svelte";
import { onDestroy } from "svelte";
let file: File | undefined;
@ -13,8 +14,11 @@
const render = async () => {
if (!file) return;
await ff.init();
await ff.transcode(file);
};
onDestroy(async () => {
await ff.cleanup();
ff.shutdown();
});
$: if (file) {
render();

View file

@ -2,6 +2,7 @@
import mime from "mime";
import LibAVWrapper from "$lib/libav/remux";
import { onDestroy } from "svelte";
import { beforeNavigate, goto } from "$app/navigation";
import { t } from "$lib/i18n/translations";
@ -102,6 +103,7 @@
});
return;
}
console.log(file_info)
totalDuration = Number(file_info.format.duration);
@ -193,6 +195,8 @@
$: if (file) {
render();
}
onDestroy(() => ff.shutdown());
</script>
<svelte:head>