使用javascript用手机拍照 [英] Take a picture with mobile using javascript

查看:146
本文介绍了使用javascript用手机拍照的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种在我的网站上用手机/平板电脑拍照的方式,其行为应为:

I'm looking for a way to take a picture with a phone/tablet on my website, the behavior should be :

  • 用户单击相机"按钮.
  • 手机摄像头亮起.
  • 用户拍照
  • 图片被存储到变量中以备将来使用

我不知道该怎么做,听说"phonegap"框架可以做到这一点,但是由于我在MVC c#项目中,所以我无法使用它. 在我看来,将很难复制,因为我怀疑网站有权从移动设备上启动任何应用程序.

I can't figure out how to do that, i heard that the "phonegap" framework does that but i can't use it since i'm on a MVC c# project. It seems to me that it will be hard to reproduce since i doubt that a web site have the right to launch any app from the mobile.

有没有一种方法可以使用javascript做到这一点?有解决方案吗?

Is there a way to do that using javascript ? Any solution ?

推荐答案

您可以使用HTML5 getUserMedia()API,本文对此进行了说明:

You can use the HTML5 getUserMedia() API, which is explained in this article: http://www.html5rocks.com/en/tutorials/getusermedia/intro/

请注意:并非所有浏览器都支持此功能.有关支持的浏览器的详细列表,请访问以下页面: http://caniuse.com/#feat=流

Be careful: not all browsers support this (yet). For a detailed list of supporting browsers, take a look at this page: http://caniuse.com/#feat=stream

这篇关于使用javascript用手机拍照的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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