使用 PHP 访问用户的网络摄像头
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/219476/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Using PHP to Access a User's Webcam
提问by btw
I'd like to allow users to record videos directly from their webcam. I haven't done much work with PHP but am stuck with it for this project. We currently have a system in place for video uploading and encoding, but nothing to actually access a user's webcam. How would you recommend I proceed?
我想允许用户直接从他们的网络摄像头录制视频。我没有用 PHP 做过多少工作,但在这个项目中坚持使用它。我们目前有一个用于视频上传和编码的系统,但没有什么可以实际访问用户的网络摄像头。你会如何建议我继续?
回答by Adam Ness
Webcams aren't available to HTML or JavaScript/DOM in any browsers that I know of, so you're going to end up dependent on some sort of plugin. I'd recommend you start your search with Adobe Flash/Flex, though It's possible that Microsoft Silverlight is able to do the same thing. Flex is a bit more reliable technology and has been around longer, but Microsoft is pouring a ton of money into Silverlight, and I expect it to improve radically over the next few years.
我所知道的任何浏览器中的 HTML 或 JavaScript/DOM 都无法使用网络摄像头,因此您最终将依赖于某种插件。我建议您使用 Adobe Flash/Flex 开始搜索,尽管 Microsoft Silverlight 可能也能做同样的事情。Flex 是一种更可靠的技术,存在时间也更长,但微软正在向 Silverlight 投入大量资金,我预计它会在未来几年内得到根本性的改进。
回答by Terminus
You need client side technology -- PHP is server side. Check out Adobe Flash/Flex. I don't know anything about Microsoft Silverlight.
您需要客户端技术——PHP 是服务器端。查看 Adobe Flash/Flex。我对 Microsoft Silverlight 一无所知。
回答by Eaton
Check out the mugshotmodule on Drupal.org. It uses a flash widget to do the image capture, then saves the image as a node. Its code can almost certainly be mined for useful functions if you need to do something similar.
查看Drupal.org 上的面部照片模块。它使用 Flash 小部件进行图像捕获,然后将图像保存为节点。如果您需要做类似的事情,几乎可以肯定它的代码可以用于有用的功能。
回答by Jorge Niedbalski R.
You can't access to underlying hardware objects from a server side scripting language. If you are insterested into access to hardware devices so you have to use "browser components" like adobe flash , active X object, java applets, etc.
您无法从服务器端脚本语言访问底层硬件对象。如果您对访问硬件设备感兴趣,那么您必须使用“浏览器组件”,例如 adobe flash 、active X object、java applet 等。
回答by Diodeus - James MacFarlane
The browser itself cannot access a user's webcam. There are proposals for a new type of input field to support this, but is is not currently available. You'd have to do it through a plug-in.
浏览器本身无法访问用户的网络摄像头。有一种新的输入字段类型的提议来支持这一点,但目前尚不可用。你必须通过插件来做到这一点。

