chrisguttandin / extendable-media-recorder

An extendable drop-in replacement for the native MediaRecorder.
MIT License
258 stars 13 forks source link

Server Error ReferenceError: Blob is not defined #671

Closed Nam6201 closed 1 year ago

Nam6201 commented 1 year ago

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?

chrisguttandin commented 1 year ago

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.

Nam6201 commented 1 year ago

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

chrisguttandin commented 1 year ago

Great, I'm happy to hear that. 🎉