Open marcofugaro opened 2 years ago
Currently, it's hard using this library directly from node_modules without copying over
mp4.wasm
.
@marcofugaro may I ask how you solved the mp4.wasm
import?
@ffdead you have to copy the mp4.wasm
over your public folder.
Got it, thanks! Had to copy it to public/node_modules/mp4-wasm/build/mp4.wasm
for future reference
const resp = await fetch('yourPathToWasm/mp4.wasm') const wasmBinary = await resp.arrayBuffer() const MP4 = await loadMP4Module({ wasmBinary })
Currently, it's hard using this library directly from node_modules without copying over
mp4.wasm
.I am using esbuild for context.
One easy solution would be to build with the emscripten flag
-s SINGLE_FILE=1
, that way the wasm binary code is encoded in the .js file. This results in a little bit filesize increase, but negligible overall.Another solution would be like ffmpeg.wasm which host the .wasm file by themselves.