'DOMException: Could not start video source | only in Chrome

I am trying to get a video from my webcam. My code is working in Firefox and Microsoft Edge perfectly but not working in Chrome. I also host my code on an HTTPS server but didn't work.

My Code:

<html>
<body>
    <script>
        navigator.mediaDevices.getUserMedia({video: true})
        .then( stream => console.log("success") )
        .catch( err => console.log(err, err.name) );
    </script>
</body>
</html>

After running this code on Google Chrome browser, I am getting this error in the console:

DOMException: Could not start video source 'NotReadableError'

Chrome Version: 100.0.4896.127 (Official Build) (64-bit) on Windows 11.



Solution 1:[1]

this error appears if the camera is already in use by another browser or application

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 DavidFM