I am currently working with webRTC and therefore use the getUserMedia() function. When doing this a red icon appears inside the tab-header. Is there a way to remove this symbol? I set my microphone stream to undefined after a certain task, but the symbol is still shown there.
Asked
Active
Viewed 1,722 times
3
-
Are you accessing the microphone at all? – evolutionxbox Mar 14 '17 at 12:31
-
Yes, for a short time – kenzie Mar 14 '17 at 12:32
-
I don't think you can then, once you've asked for permission to use it... – evolutionxbox Mar 14 '17 at 12:33
-
See also https://stackoverflow.com/q/44274410/1066234 – Avatar Feb 01 '21 at 14:01
1 Answers
6
You have to stop the MediaStream
(MediaStreamTracks
) you've acquired with getUserMedia
stream.getTracks().forEach(track => track.stop());
stream.stop(); // deprecated in FFox

wpp
- 7,093
- 4
- 33
- 65
-
-
Nope, you'd need to acquire a new stream. https://developer.mozilla.org/de/docs/Web/API/MediaStreamTrack – wpp Mar 14 '17 at 14:52
-
What if stream was started by third party and i did not call getUserMedia to initilize the stream then in this case how do i get the reference of created stream object and how to stop it? – Umer Ali Apr 19 '20 at 10:32
-
That really depends on the third party library and how they manage the stream object. If it is open source I'd suggest looking into the source code, otherwise their documentation. Or you can try and get some information about the environment through the browser's debugger. – wpp Apr 20 '20 at 07:15