How to Use getUserMedia()

Learn how to use getUserMedia() to access audio and video input from the user. The getUserMedia() method is available through the MediaDevices object exposed by navigator.mediaDevices. Warning: Although the navigator object still exposes a deprecated getUserMedia() method, it is recommended to use getUserMedia() through the mediaDevices object for consistency. Here’s how you can use the getUserMedia() method: Assume we have a button: <button>Start streaming</button> We wait for the user to click this button and then call the navigator....