-2

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?

microphone icon

edit

After inspecting LocalMediaStream object I've found stop() function in prototype and it worked!

Bram Vanroy
  • 27,032
  • 24
  • 137
  • 239
aiven
  • 3,775
  • 3
  • 27
  • 52
  • 2
    You found the solution by yourself, which is great! Instead of adding the solution to your original post as an edit, it's better to add it as an answer and mark it as correct. That way, the community knows the question is answered and accepted. – Bram Vanroy Oct 16 '18 at 13:45
  • or just delete useless question :) – aiven Oct 16 '18 at 13:46
  • It's not useless! It might help others who have the same question. It's best to add the answer for whoever is looking for this. – Bram Vanroy Oct 16 '18 at 13:48

1 Answers1

0

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.

Bram Vanroy
  • 27,032
  • 24
  • 137
  • 239
mayk93
  • 1,489
  • 3
  • 17
  • 31