如何使用JavaScript获取计算机中附带的摄像机列表? [英] How can I get a list of video cameras attached in my computer using JavaScript?

查看:92
本文介绍了如何使用JavaScript获取计算机中附带的摄像机列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想显示连接到用户计算机的摄像机列表,当他们选择一个时,在HTML5 < video> 中显示来自该摄像机的流媒体视频标签。

I want to display a list of video cameras attached to the user's computer, and when they select one, display streaming video from that camera in an HTML5 <video> tag.

如何获得连接到用户计算机的摄像机列表?

How can I get a list of the video cameras attached to the user's computer?

推荐答案

也许 Navigator.getUserMedia() (使用 WebRTC 引擎盖下)是你正在寻找的,虽然我没有看到任何会直接告诉你什么设备可用(设备列表没有暴露给你的代码 - 它在询问时呈现给用户)获得访问可用硬件的许可。)

Perhaps Navigator.getUserMedia() (uses WebRTC under the hood) is what you're looking for, though I don't see anything that will directly tell you what devices are available (the list of devices isn't exposed to your code—it's presented to the user when asking for permission to access available hardware).

另请注意浏览器支持:Chrome 21 +,Firefox 20 +,Opera 12+,不支持IE和Safari。

Also note the browser support: Chrome 21+, Firefox 20+, Opera 12+, no support for IE and possibly Safari.

这篇关于如何使用JavaScript获取计算机中附带的摄像机列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆