Closed fodaysahid closed 4 years ago
I am having the same error in Safari when using in React. There is no error in other browsers
Can you share the complete code?
It looks like you're calling Mp3Recorder.stop
as it was a singleton, which won't work.
Also, maybe you're creating Mp3Recorder
into a React's render
function, and if that's the case, you'll end up with different instances of the recorder, as every time the render
function is executed, it will create a new Mp3Recorder
. In such case, if you're using a functional component, you should instantiate the recorder with useMemo
, eg:
const recorder = useMemo(() => new MicRecorder(...), []);
Then React will make sure your recorder instance remains the same across renders.
Thanks. Have fixed the issue. I wasn't using useMemo()
When I Click on the Stop recording button. It throws the error above.