How to close peerConnection in WebRtc
If I click on the call, the top screen displays the allow / deny menu. When I click allow, Chrome starts displaying a red circle in the title, which signals that the microphone is active. All other sounds in other Chromes tabs are disabled (for example, YouTube videos).
When I press the plug, the red circle does not disappear, the video in the second tab is still disconnected. I have to press F5 to restore the state it was before the call.
Is there a PeerConnection to stop the call and stop microphone recording?
source to share
Yes, the reason the "red light" is still on is because the media tracks in the mediaStream object (named localstream
on this particular page) collected with are getusermedia
still playing / active.
To close the media stream and thus release any commit on the local media inputs, simply invoke localstream.stop()
which will end the stream and stop accessing the local media input. This will stop all linked media tracks.
You can also do this by calling stop()
on separate media tracks (captured from getVideoTracks
or getAudioTracks
from mediaStream
).
As for other sound that is disabled in other pages / apps. Below is the crbug handling .
Side note: if the media is pushed through a peerConnection, you probably have to renegotiate the connection due to the change mediaStream
.
source to share