Search code examples
javascriptreactjsgetusermediamediadevices

How to stop all mediaStreams


is there any way to generally just shut down all media streams?

I'm working with a package called wavesurfer in react and i can't stop the microphone with the given methods of the package. So i was wondering if there is anything to just cut all the audio/video devices as easily as possible?

Something like

if (mediaDevice === active) {
   mediaDevice.stop()
}

Solution

  • No there isn't.
    You must have access to all the MediaStreamTracks that do use the device and call their stop() method.