react-app icon indicating copy to clipboard operation
react-app copied to clipboard

SharedArrayBuffer is not defined

Open ottoptika opened this issue 3 years ago • 4 comments

Hey I'm trying to convert Blob data from RecordRTC from webm to mp4. The script seems to be working and initialized, but React/NextJS throws a SharedArrayBuffer. Searching for that term gives me some answers about some vulnerability in SAB, but I don't understand what's up and down. It says there's a way to re-enable it though? Is it a bug in ffmpegwasm or is there something deeper to it? As I'm creating a ReactJS website, I should be able to follow your example of your 'react-app' no?

Thanks

ottoptika avatar Mar 22 '22 21:03 ottoptika

From https://github.com/ffmpegwasm/ffmpeg.wasm:

Only browsers with SharedArrayBuffer support can use ffmpeg.wasm, you can check HERE for the complete list.

skogsbrus avatar Apr 19 '22 20:04 skogsbrus

make sure you add setupProxy.js file in your src folder

DavraYoung avatar Mar 22 '23 17:03 DavraYoung

the contents should be:

module.exports = (app) => {
    app.use((_, res, next) => {
        res.setHeader('Cross-Origin-Opener-Policy', 'same-origin');
        res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp');
        next();
    });
};

DavraYoung avatar Mar 22 '23 17:03 DavraYoung

  1. copy ffmpeg-core in you public folder, like this
image
  1. set corePath with createFFmpeg()
  const ffmpeg = createFFmpeg({
    corePath: "/ffmpeg/[email protected]/ffmpeg-core.js",
    log: true,
  });
  1. npm start with HTTPS env

HTTPS=true npm start

libo1106 avatar Jun 08 '23 06:06 libo1106