Uncaught ReferenceError: createFFmpegCore is not defined
See original GitHub issueAs you can see the
import React from "react";
import { createFFmpeg, fetchFile } from "@ffmpeg/ffmpeg";
const ffmpeg = createFFmpeg({
log: true,
});
function App() {
const [ready, setReady] = React.useState(false);
const load = async () => {
await ffmpeg.load();
setReady(true);
};
React.useEffect(() => {
load();
}, []);
.
.
.
I got a Bad memory error too! How to fix this?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:21
- Comments:21
Top Results From Across the Web
FFmpeg.wasm stopped working after adding cross origin ...
After that, now when I try to run the code I just got Uncaught ReferenceError: FFmpeg is not defined. The error is happening...
Read more >ffmpegjs - Bountysource
CreateFFmpegCore is not undefined. $ 0 ... In Next.js, Uncaught (in promise) ReferenceError: _ is not defined will happen with valid configuration.
Read more >FFmpeg.wasm, a pure WebAssembly / Javascript port of ...
wasm is not as fast as FFmpeg, but it might come in handy for certain use cases. In this post, I would like...
Read more >Uncaught ReferenceError: unityFramework is not defined at ...
Bug Uncaught ReferenceError: unityFramework is not defined at HTMLScriptElement.script.onload (WebGL).
Read more >[Showoff saturday] An online tool that allow you to cut a video ...
Uncaught (in promise) ReferenceError: SharedArrayBuffer is not defined createFFmpegCore 9e6bab1c-3237-451a-9bca-dafd8166b9e5:22 e ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This started to work for me in NextJS when I removed the
http://localhost:3000/public
part. I copied thenode_modules/@ffmpeg/core/dist
folder into public and renamed itffmpeg_core_dist
for clarity. Thenworked locally. But on production I got the error
Uncaught (in promise) ReferenceError: SharedArrayBuffer is not defined
which I was able to fix by adding these headers to next.config.js:But this is not a perfect solution because
SharedArrayBuffer is not defined
still happens sometimes on page load and a reload is needed to get ffmpeg to load. Also it has other issues mentioned here. This all has to do with the security of SharedArrayBuffer that goes above my head.For anyone using
react-scripts
orcreate-react-app
to run React, you can send headers manually by using a customized middleware (https://create-react-app.dev/docs/proxying-api-requests-in-development/#configuring-the-proxy-manually).First, install
http-proxy-middleware
:or
Then, create
src/setupProxy.js
file and put our logic in there: