使用javascript用手机拍照

编程入门 行业动态 更新时间:2024-10-18 08:29:27
本文介绍了使用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,本文对此进行了说明: 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用手机拍照

本文发布于:2023-11-27 07:39:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637149.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:用手   javascript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!