我正在寻找一种在我的网站上用手机/平板电脑拍照的方式,其行为应为:
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,本文对此进行了说明: www.html5rocks/en/tutorials/getusermedia/intro/
You can use the HTML5 getUserMedia() API, which is explained in this article: www.html5rocks/en/tutorials/getusermedia/intro/
请注意:并非所有浏览器都支持此功能.有关支持的浏览器的详细列表,请访问以下页面: caniuse/#feat=流
Be careful: not all browsers support this (yet). For a detailed list of supporting browsers, take a look at this page: caniuse/#feat=stream
更多推荐
使用javascript用手机拍照
发布评论