javascript - navigator.mediaDevices.getUserMedia return NotReadableError: Could not start video source - Stack Overflow

i have a problem when accessing my webcam through my web app. i following the example code to how to ac

i have a problem when accessing my webcam through my web app. i following the example code to how to accessing webcam in MDN web doc. but when i try to run my web app, it shows error NotReadableError: Could not start video source in chrome console.

my web app run with https, on desktop google chrome version 81.04 and chromium rasbian version 78.0. it doesn't work with my built in laptop webcam and my raspberry pi with logitech webcam

does anyone has a solution ? thanks in advance !

this is my code.

<html>
<head>
</head>
<body>
 <video id="video-input"></video>
 <script type="text/javascript">
  var video = document.getElementById('video-input');

	navigator.mediaDevices.getUserMedia({ video:true, audio:false})
		.then(function(stream){
			video.srcObject = stream;
      video.play();
		})
		.catch(function(err) {
        console.log("An error occurred! " + err);
    });
 </script>
</body>
</html>

i have a problem when accessing my webcam through my web app. i following the example code to how to accessing webcam in MDN web doc. but when i try to run my web app, it shows error NotReadableError: Could not start video source in chrome console.

my web app run with https, on desktop google chrome version 81.04 and chromium rasbian version 78.0. it doesn't work with my built in laptop webcam and my raspberry pi with logitech webcam

does anyone has a solution ? thanks in advance !

this is my code.

<html>
<head>
</head>
<body>
 <video id="video-input"></video>
 <script type="text/javascript">
  var video = document.getElementById('video-input');

	navigator.mediaDevices.getUserMedia({ video:true, audio:false})
		.then(function(stream){
			video.srcObject = stream;
      video.play();
		})
		.catch(function(err) {
        console.log("An error occurred! " + err);
    });
 </script>
</body>
</html>

Share Improve this question asked May 2, 2020 at 9:26 Farhan RabbaaniiFarhan Rabbaanii 4631 gold badge9 silver badges16 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

From MDN, in the page you linked in your question:

NotReadableError

Although the user granted permission to use the matching devices, a hardware error occurred at the operating system, browser, or Web page level which prevented access to the device.

This is a problem that happens between the browser and the device. It might be because of the driver. Your example works for me (not in the Stack Snippet), so I can't tell you what's exactly happening and how to solve it.

I would remend you updating your drivers.

It may be the camera is already being used by another process

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745656142a4638553.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信