Skip to content

Commit

Permalink
fix: vite worker
Browse files Browse the repository at this point in the history
  • Loading branch information
lyonbot committed Apr 13, 2024
1 parent 6282f4e commit d09a07e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ffmpeg.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { FFmpeg } from "@ffmpeg/ffmpeg";
import { fetchFile, toBlobURL } from '@ffmpeg/util';
import { updateStore } from "./store";
import workerURL from '@ffmpeg/ffmpeg/worker?url';
// import workerURL from '@ffmpeg/ffmpeg/worker?worker';

export async function initFFmpeg() {
let ffmpeg = new FFmpeg()
const CORE_VERSION = '0.12.6'
const baseURL = 'https://unpkg.com/@ffmpeg/core@' + CORE_VERSION + '/dist/esm'

// Load the WASM file and coreURL
const [coreURL, wasmURL, classWorkerURL] = await Promise.all([
const [coreURL, wasmURL] = await Promise.all([
toBlobURL(`${baseURL}/ffmpeg-core.js`, 'text/javascript'),
toBlobURL(`${baseURL}/ffmpeg-core.wasm`, 'application/wasm'),
workerURL
])
const classWorkerURL = new URL('@ffmpeg/ffmpeg/worker', import.meta.url)

await ffmpeg.load({
coreURL,
wasmURL,
classWorkerURL,
classWorkerURL: classWorkerURL.toString(),
});

updateStore({ ffmpeg })
Expand Down

0 comments on commit d09a07e

Please sign in to comment.