Accessing Available Devices in Browser via getUserMedia()
The Covid-19 pandemic got me scrambling to come up with some web based solutions to support local Summer art festivals. In April I started digging into WebRTC as a potential in-browser low-barrier-to entry Real Time video solution. After some success...
hashnode.blainegarrett.com7 min read
Blaine Garrett
Software Engineer and Artist
Update: In the handleSuccess callback I added a few lines stop the stream. It was a little disconcerting navigating to a new page and having the camera light still on.
stream.getTracks().forEach(function (track) { track.stop(); // e.g. turn camera off, etc });In a future version, I'll store the device stream in a ref and run similar code when unmounting the React component.