fix: audio uploading not working

This commit is contained in:
not-nullptr 2024-11-14 09:15:07 +00:00
parent 592bd1c1d9
commit 831e989bd4
2 changed files with 16 additions and 4 deletions

View File

@ -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/core@0.12.6/dist/esm";
await this.ffmpeg.load({
coreURL: `${baseURL}/ffmpeg-core.js`,
wasmURL: `${baseURL}/ffmpeg-core.wasm`,

View File

@ -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),
});
};
},
);
});