简体   繁体   English

使用javascript用手机拍照

[英]Take a picture with mobile using javascript

I'm looking for a way to take a picture with a phone/tablet on my website, the behavior should be : 我正在寻找一种方法在我的网站上用手机/平板电脑拍照,行为应该是:

  • The user click a "camera" button. 用户单击“相机”按钮。
  • The mobile camera show on. 移动相机显示。
  • The user take a picture 用户拍照
  • The picture is stored into a variable for a future usage 图片存储在变量中以供将来使用

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. 我无法弄清楚如何做到这一点,我听说“phonegap”框架可以做到这一点,但我不能使用它,因为我正在使用MVC c#项目。 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. 在我看来,它很难再现,因为我怀疑一个网站有权从手机上启动任何应用程序。

Is there a way to do that using javascript ? 有没有办法用javascript做到这一点? Any solution ? 有解决方案吗

You can use the HTML5 getUserMedia() API, which is explained in this article: http://www.html5rocks.com/en/tutorials/getusermedia/intro/ 您可以使用HTML5 getUserMedia()API,本文将对此进行说明: http//www.html5rocks.com/en/tutorials/getusermedia/intro/

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 有关支持浏览器的详细列表,请查看此页面: http//caniuse.com/#feat=stream

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM