最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin2浏览0评论

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

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论