Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Vite example? #798

Unanswered
melMass asked this question in Q&A
Nov 26, 2024 · 2 comments · 2 replies
Discussion options

Hi,

I'm trying to make it work but load never resolves and reading the docs I'm not sure to understand how it's expected to load the worker and wasm file.

Installation says:

Note

As @ffmpeg/ffmpeg spawns a web worker, you cannot import @ffmpeg/ffmpeg from CDN like unpkg. It is recommended to download it and host it on your server most of the time.

But the next section only shows how to load the worker and wasm file from unpkg, not how to bundle it

Thanks

You must be logged in to vote

Replies: 2 comments 2 replies

Comment options

Related to #568 I guess.
Here is what I tried:

import ffmpegWasm from '@ffmpeg/core-mt/wasm?url' // resolves to "/@fs/node_modules/@ffmpeg/core-mt/dist/esm/ffmpeg-core.wasm" in dev
import ffmpegCore from '@ffmpeg/core-mt?url' // resolves to "/@fs/node_modules/@ffmpeg/core-mt/dist/esm/ffmpeg-core.js" in dev
await this.ffmpeg.load({
 coreURL: await toBlobURL(ffmpegCore, 'text/javascript'),
 wasmURL: await toBlobURL(ffmpegWasm, 'application/wasm')
})
You must be logged in to vote
0 replies
Comment options

joy of code has a tutorial on ffmpeg wasm in sveltekit pwa, i'm guessing it should be possible

You must be logged in to vote
2 replies
Comment options

Just scrubbing it seems he just copies the build output, sure it's a way but not really "bundle friendly" which I assume most people use nowadays.
Vite has the tooling for what this project needs so I don't get why it's not simplifi (just check the amount of issues about worker hosting)

Comment options

Thanks still as I think I can find a way around it using https://www.npmjs.com/package/vite-plugin-cdn-import

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /