videojs-record: ffmpeg.wasm plugin: React throws ReferenceError: FFmpeg is not defined
Description
Briefly describe the issue.
created new react app using create-react-app
Using screen share recording and saveAs works fine but when using plugin to convert it throws this error.
convert plugin using:
const videoJsOptions = {
controls: true,
bigPlayButton: false,
width: 320,
height: 240,
fluid: false,
plugins: {
record: {
audio: true,
screen: true,
displayMilliseconds: false,
debug: true,
convertEngine: "ffmpeg.wasm",
convertWorkerURL: "../../node_modules/@ffmpeg/core/dist/ffmpeg-core.js",
// convert recorded data to MP4 (and copy over audio data without encoding)
convertOptions: [
"-c:v",
"libx264",
"-preset",
"slow",
"-crf",
"22",
"-c:a",
"copy",
"-f",
"mp4",
],
// specify output mime-type
pluginLibraryOptions: {
outputType: "video/mp4",
},
},
},
};
My Imports -
import React, { Component } from "react";
import logo from "./logo.svg";
import "./App.css";
import "video.js/dist/video-js.css";
import "videojs-record/dist/css/videojs.record.css";
import "@ffmpeg/ffmpeg/dist/ffmpeg.min.js";
import videojs from "video.js";
import "webrtc-adapter";
import RecordRTC from "recordrtc";
import Record from "videojs-record/dist/videojs.record.js";
import FFmpegWasmEngine from "videojs-record/dist/plugins/videojs.record.ffmpeg-wasm.js";

About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 8
- Comments: 17 (2 by maintainers)
I uninstalled ffmpeg version 0.10.* then installed “@ffmpeg/core”: “^0.8.5”, “@ffmpeg/ffmpeg”: “^0.9.8”,
it works now fine with react. No idea why this worked
Are there any updates on how to solve this? Doing this doesnt work for me.
You just saved my day!! Thank you!
@MohannadEhabBarakat I have the same error using Vue.js. Do you have any ideas why it happens? Downgrading @ffmpeg/core and @ffmpeg/ffmpeg doesn’t help me.
any solutions?