SharedArrayBuffer is not defined
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
From https://github.com/ffmpegwasm/ffmpeg.wasm:
Only browsers with SharedArrayBuffer support can use ffmpeg.wasm, you can check HERE for the complete list.
make sure you add setupProxy.js file in your src folder
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();
});
};
- copy ffmpeg-core in you public folder, like this
- set
corePathwithcreateFFmpeg()
const ffmpeg = createFFmpeg({
corePath: "/ffmpeg/[email protected]/ffmpeg-core.js",
log: true,
});
- npm start with HTTPS env
HTTPS=true npm start