2024-08-10 12:21:39 +01:00
|
|
|
<script lang="ts">
|
2024-08-12 18:06:45 +01:00
|
|
|
import LibAVWrapper from "$lib/libav";
|
2024-08-10 12:21:39 +01:00
|
|
|
import { openURL } from "$lib/download";
|
|
|
|
|
2024-08-11 13:30:42 +01:00
|
|
|
import DragDropArea from "$components/misc/DragDropArea.svelte";
|
|
|
|
import OpenFileButton from "$components/misc/OpenFileButton.svelte";
|
2024-08-11 08:05:15 +01:00
|
|
|
|
2024-08-11 13:30:42 +01:00
|
|
|
let draggedOver = false;
|
|
|
|
let file: File;
|
2024-08-11 08:05:15 +01:00
|
|
|
|
2024-08-11 13:30:42 +01:00
|
|
|
const render = async () => {
|
2024-08-12 18:06:45 +01:00
|
|
|
const ff = new LibAVWrapper();
|
2024-08-11 08:05:15 +01:00
|
|
|
await ff.init();
|
|
|
|
|
2024-08-12 18:06:45 +01:00
|
|
|
const render = await ff.render({
|
|
|
|
blob: file,
|
2024-08-11 08:05:15 +01:00
|
|
|
args: ["-c", "copy"],
|
|
|
|
});
|
|
|
|
|
2024-08-11 13:30:42 +01:00
|
|
|
if (render) {
|
|
|
|
openURL(URL.createObjectURL(render));
|
|
|
|
} else {
|
|
|
|
console.log("not a valid file")
|
|
|
|
}
|
2024-08-11 08:05:15 +01:00
|
|
|
};
|
|
|
|
|
2024-08-11 13:30:42 +01:00
|
|
|
$: if (file) {
|
|
|
|
render();
|
|
|
|
}
|
2024-08-10 12:21:39 +01:00
|
|
|
</script>
|
|
|
|
|
2024-08-11 13:30:42 +01:00
|
|
|
<DragDropArea id="remux-container" bind:draggedOver bind:file>
|
|
|
|
<OpenFileButton bind:draggedOver bind:file />
|
|
|
|
</DragDropArea>
|
2024-08-10 12:21:39 +01:00
|
|
|
|
|
|
|
<style>
|
2024-08-11 13:30:42 +01:00
|
|
|
:global(#remux-container) {
|
2024-08-10 12:21:39 +01:00
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
</style>
|