简体   繁体   English

navigator.mediaDevices.getUserMedia 返回 NotReadableError:无法启动视频源

[英]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.

相关问题 navigator.mediaDevices.getUserMedia API 因错误“NotReadableError:并发麦克风进程限制”而拒绝。 - navigator.mediaDevices.getUserMedia API rejecting with error "NotReadableError: Concurrent mic process limit." 带有 getUsermedia() 的前置摄像头错误错误:“Notreadableerror:无法启动视频源” - Front camera error with getUsermedia() Error: “Notreadableerror: could not start video source” Javascript navigator.mediaDevices.getUserMedia获取源的宽度和高度 - Javascript navigator.mediaDevices.getUserMedia get width and height at source navigator.mediaDevices.getUserMedia 视频质量和面对模式约束 - navigator.mediaDevices.getUserMedia Video quality and facing mode constraints Firefox从不解析navigator.mediaDevices.getUserMedia() - Firefox never resolving navigator.mediaDevices.getUserMedia() navigator.mediaDevices.getUserMedia 与 http 服务器 - navigator.mediaDevices.getUserMedia with http server Chrome:navigator.mediaDevices.getUserMedia 不是一个函数 - Chrome: navigator.mediaDevices.getUserMedia is not a function navigator.mediaDevices.getUserMedia错误“ DOMException” - navigator.mediaDevices.getUserMedia Error “DOMException” DOMException: 权限被拒绝 - navigator.mediaDevices.getUserMedia(); - DOMException: Permission denied - navigator.mediaDevices.getUserMedia( ); 从 navigator.mediaDevices.getUserMedia 调用 function - call a function from navigator.mediaDevices.getUserMedia
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM