---
title: "Comment by Blaine Garrett on \"Accessing Available Devices in Browser via getUserMedia()\" | Hashnode"
description: "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 st"
url: "https://hashnode.com/posts/accessing-available-devices-in-browser-via-getusermedia/5f6f8ecf0ba48d6624c91a60/comment/5f70b6db531ea76fd9689cc3"
---

[Discussion](https://hashnode.com/posts/accessing-available-devices-in-browser-via-getusermedia/5f6f8ecf0ba48d6624c91a60)

Comment [Accessing Available Devices in Browser via getUserMedia()](https://hashnode.com/posts/accessing-available-devices-in-browser-via-getusermedia/5f6f8ecf0ba48d6624c91a60)

[Sep 27, 2020](https://hashnode.com/posts/accessing-available-devices-in-browser-via-getusermedia/5f6f8ecf0ba48d6624c91a60/comment/5f70b6db531ea76fd9689cc3)

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.
