chrisguttandin/extendable-media-recorder

Server Error ReferenceError: Blob is not defined

Closed this issue · 3 comments

import { MediaRecorderAudio } from "extendable-media-recorder"
//////////
async function requestRecorder() {
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
const options = { mimeType: "audio/wav" };

const recorder = new MediaRecorderAudio(stream, options);
console.log(recorder.mimeType)
return recorder
}

image

This is my code, it doesn't work due to the Blob error, but i don't understand where these problems come from?

Hi @Nam6201,

I suspect you run the code with Node.js. This library is meant to run in the browser. Unfortunately it's not possible to use it with Node.js.

Actually, my project is based on NextJs, after searching some similar issues on Google and StackOverflow, i realized this error came from NextJs syntax, so i changed my component from normal import to dynamic import and it worked. Finally, i wanna say thanks for your answer and your recorder packaged, it helped me a lot in my project. <3 <3 <3

Great, I'm happy to hear that. 🎉