[英]navigator.mediaDevices.getUserMedia return NotReadableError: Could not start video source
i have a problem when accessing my webcam through my web app.通过我的 web 应用程序访问我的网络摄像头时遇到问题。 i following the example code to how to accessing webcam in MDN web doc .
我按照示例代码了解如何访问MDN web 文档中的网络摄像头。 but when i try to run my web app, it shows error
NotReadableError: Could not start video source
in chrome console.但是当我尝试运行我的 web 应用程序时,它显示错误
NotReadableError: Could not start video source
。
my web app run with https, on desktop google chrome version 81.04 and chromium rasbian version 78.0.我的 web 应用程序使用 https 在桌面 google chrome 版本 81.04 和 chromium rasbian 版本 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>
From MDN, in the page you linked in your question:来自 MDN,在您在问题中链接的页面中:
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.
尽管用户授予了使用匹配设备的权限,但操作系统、浏览器或 Web 页面级别发生了硬件错误,从而阻止了对设备的访问。
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 recommend you updating your drivers.我建议您更新驱动程序。
It may be the camera is already being used by another process可能是相机已被另一个进程使用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.