Skip to content

armgit / VERT

Public Imported from GitHub
0

The next-generation file converter. Open source, fully local* and free forever.

fix: audio uploading not working (#15)

nullptr576202eea7f4
diff --git a/src/lib/converters/ffmpeg.svelte.ts b/src/lib/converters/ffmpeg.svelte.ts
index b59d7d5..cdb351d 100644
--- a/src/lib/converters/ffmpeg.svelte.ts
+++ b/src/lib/converters/ffmpeg.svelte.ts
@@ -30,7 +30,8 @@ export class FFmpegConverter extends Converter {
if (!browser) return;
this.ffmpeg = new FFmpeg();
(async () => {
- const baseURL = "https://unpkg.com/@ffmpeg/core@latest/dist/esm";
+ const baseURL =
+ "https://cdn.jsdelivr.net/npm/@ffmpeg/[email protected]/dist/esm";
await this.ffmpeg.load({
coreURL: `${baseURL}/ffmpeg-core.js`,
wasmURL: `${baseURL}/ffmpeg-core.wasm`,
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 7ef9ec8..7ffc27b 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -41,13 +41,14 @@
// get the blob
canvas.toBlob(
(blob) => {
- if (blob === null)
- reject("Failed to convert image to blob");
resolve({
file: f,
from,
to,
- blobUrl: URL.createObjectURL(blob!),
+ blobUrl:
+ blob === null
+ ? ""
+ : URL.createObjectURL(blob),
id: Math.random().toString(36).substring(2),
});
},
@@ -55,6 +56,16 @@
0.75,
);
};
+
+ img.onerror = () => {
+ resolve({
+ file: f,
+ from,
+ to,
+ blobUrl: "",
+ id: Math.random().toString(36).substring(2),
+ });
+ };
},
);
});