How to completely kill the WebRTC media stream?
MediaStream.stop()
is not working anymore.
Testing in Chrome 47, Mac OS 10.11.
Use stream. getTracks(). forEach(track => track. stop()); .
Stopping a video stream This works by obtaining the video element's stream from its srcObject property. Then the stream's track list is obtained by calling its getTracks() method. From there, all that remains to do is to iterate over the track list using forEach() and calling each track's stop() method.
The MediaStreamTrack interface represents a single media track within a stream; typically, these are audio or video tracks, but other track types may exist as well.
Use stream.getTracks().forEach(track => track.stop());
.
stream.stop()
was deprecated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With