After I obtained microphone permission with navigator.mediaDevices.getUserMedia({ audio: true })
and done everything I want with media stream how can I remove microphone permission and remove this annoying icon from tab and toolbar?
After inspecting LocalMediaStream
object I've found stop()
function in prototype and it worked!
I would recommend looking into the permissions api.
You should be able to revoke the permission, something like this:
const microphone = navigator.permissions.query({ name: 'microphone' })
navigator.permissions.revoke(microphone)
We can use microphone
directly in permissions.query
because it is a valid name.