如何通过javascript访问摄像头 [英] How to access the webcam by javascript

查看:141
本文介绍了如何通过javascript访问摄像头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过JavaScript打开摄像头
我知道可以通过< video> 访问html5,但需要使用纯JavaScript访问摄像头



有人可以帮我或给我一些建议吗?



我只需使用JavaScript访问摄像头,我的英语,我正在使用谷歌翻译。



我无法使用标签'<视频>'

解决方案

正如我所说的评论,我对你的措辞感到困惑。你说,你知道HTML5可以访问网络摄像头,但是你需要用纯Javascript。



好吧,如果你不知道, HTML5 引入了实时通信 的简称​​ WebRTC 。其中一部分,引入了一个名为 navigator.getUserMedia() navigator.mediaDevices.getUserMedia(constraints)的新东西。也就是说,一个ECMAscript对象,它允许您访问用户机器 WebCam Microphone 设备。

正如您所看到的,整个演出都嵌入在HTML5的卷展栏/规范中,所以我们无法真正将Javascript与HTML5分开。



<进一步阅读:



I need to open the webcam via JavaScript I know it is possible to access the html5 by <video> but need access webcam with pure JavaScript

Can someone help me or give me some ideas?

I need only access the webcam with JavaScript and sorry for my English, I'm using Google translator.

I can't use tag '< video >'

解决方案

As I stated as comment, I'm confused about your wording. You said, you know that "HTML5" can access the webcam, but you need it by pure Javascript.

Well, in case you don't know, HTML5 introduced the such called WebRTC which is short for Real-Time Communications. Part of that, a new thing called navigator.getUserMedia() navigator.mediaDevices.getUserMedia(constraints) was introduced as well. That is, an ECMAscript object, which allows you to get access to the users machine WebCam and Microphone devices.

As you can see, the whole show is embedded in the HTML5 rollout / spec, so we cannot really separate the Javascript from the HTML5 here.

Further reading:

这篇关于如何通过javascript访问摄像头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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