Make browser "recording" notification go away after recording is stopped
Browsers are required by the getUserMedia spec to indicate to the user when audio is being recorded. The desktop versions of Chrome and Firefox implement this as a red icon in the current browser tab. Chrome for Android implements it as a notification on the user's lock screen.
Currently with WebAudioTrack, the indicator remains active after recording is finished. This could give users the perception that a site is keeping the microphone active for the purpose of eavesdropping on them.
This patch provides a fix. It might have sufficed to use this.microphoneStream.getTracks()[0].stop() instead, but I thought I'd err on the safe side and just close all open tracks.
For me, personally, stopping the tracks does not actually remove that dot, tested on chrome and safari ( macOS ).
Basically, I just want to make a recording tool, start -> stop -> send. Then action repeats, if user desires so.
Even if the microphoneStream's tracks are all stopped and stream seems to be "ended", that icon still pops in there. I've tried replacing .clone with the tracks stop above, issue still persists, sometimes works in chrome, after half a minute or so, sometimes it doesn't, whereas in Safari it never stops, quite weird in fact.
Then I checked https://ai.github.io/audio-recorder-polyfill/ so I'm sure it's not a browser's bug, given it works just fine, but, I simply can't get it to work correctly here ... as people will tend to think we're listening to them lol.