closeio / mic-recorder-to-mp3

Microphone Recorder to mp3
MIT License
238 stars 130 forks source link

TypeError: Cannot read property 'finish' of undefined #14

Closed gihanrangana closed 4 years ago

gihanrangana commented 4 years ago

getting TypeError: Cannot read property 'finish' of undefined from mic-recorder-to-mp3/dist/index.js:15941

brunoqs commented 4 years ago

@GihanRangana Please if u are using React, try to use Component Class instead of Function Component, it works for me

crbentle commented 4 years ago

It works in a Functional Component if you memoize the recorder. const recorder = useMemo(() => new MicRecorder({ bitRate: 128 }), []);

Without this, the recorder you used to start() is not the same one used to stop() and that is causing the problem.

cystudyeverday commented 4 years ago

crbentle 's method saves my day!!Thanks a lot

buzinas commented 4 years ago

This issue only happen when you're trying to finish a non-started recorder. Probably related to https://github.com/closeio/mic-recorder-to-mp3/issues/14#issuecomment-598175708.

JeremiahUL commented 2 years ago

Anyone having this issue. Try to confirm that .start() is being called first