Take a picture with mobile using javascript

南楼画角 提交于 2019-12-21 09:19:13

问题


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. 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 ? Any solution ?


回答1:


You can use the HTML5 getUserMedia() API, which is explained in this article: 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



来源:https://stackoverflow.com/questions/28942549/take-a-picture-with-mobile-using-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!