0

I have tried using this code to remove icon of camera and microphone that appeared in browser even after closing the stream

enter image description here

var videoTrack = this.localStream.getVideoTracks()[0]
    if(videoTrack){
      this.localStream.removeTrack(videoTrack)
      videoTrack.stop()
    }

    var audioTrack = this.localStream.getAudioTracks()[0]
    if(audioTrack){
      this.localStream.removeTrack(audioTrack)
      audioTrack.stop()
    }

Also, I tried. But no luck.

this.localStream.getTracks().forEach((track => {
        track.stop();
      }))

How can i remove these icons from browser.

I am using webRTC

Mahesh Joshi
  • 608
  • 8
  • 9
  • Are you sure you don't do an other request to the devices in other tracks? – Kaiido Feb 01 '21 at 04:14
  • 1
    Does this answer your question? [how do I release the camera and microphone after a WebRTC call?](https://stackoverflow.com/questions/62732910/how-do-i-release-the-camera-and-microphone-after-a-webrtc-call) – Nik Feb 01 '21 at 04:15

0 Answers0