A
A
artmirarmi2020-05-29 06:47:24
JavaScript
artmirarmi, 2020-05-29 06:47:24

Why doesn't getUserMedia work in chrome?

Why doesn't this code work in Google Chrome browser?

navigator.mediaDevices.getUserMedia({ video: true })
          .then((stream) => {
            stream.getTracks().forEach((track) => track.stop());
            this.loadCameras();
          })
          .catch((error) => console.log(error));

Camera access is requested and an error appears in the console
DOMException: Could not start video source

What could be the problem?
Everything works in Firefox.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question