audio-recorder-polyfill
audio-recorder-polyfill copied to clipboard
Microphone resource not released after stopping
Even after we run recorder.stop(), there is still a little microphone icon in the tab / corner of the screen that is using audio-recorder-polyfill.
This is not desirable, as it can prevent other usages of the microphone, mess with the audio being played to headphones, give the user a sense of unease, etc.
For a minimal reproducible example, consider this CodePen (not mine). Notice that even after "stopping" has been logged, and the recorder has been stopped, the microphone has still not been released (as evidenced by the browser tab).
Is there a way around this or fix that could be implemented to better emulate the behavior of the native MediaRecorder, which has this "microphone in-use" signal terminate after a call to recorder.stop()?
I don’t know a way to fix it (I don’t use this polyfill myself since all modern browsers don’t need it).
If you find out a way, please send PR to code or docs.
You have to stop the tracks in the stream as well so in your CodePen just do recorder.stream?.getTracks().forEach((t) => t.stop());. This is not an issue specific to this library.