简体   繁体   中英

Web application - Capture a photo?

I have a web application that folks run on both desktops (Mac, Windows), and mobile devices (tablets, phones).

I'd like to capture a photo (with the user's consent of course) in one of the pages of my web app. Tablet and phone users would use the built in camera, and desktop users will use the web cam, if available.

Is there any client-side javascript library that can assist me?

You can use webcam.js which uses HTML5 getUserMedia API and provides Flash fallback mechanism. I use this library on production and it works perfect.

The getUserMedia API doesn't require any external libraries and allows Javascript access to the Webcam for photos or videos. The downside is that this is only supported on Chrome, Firefox and Edge currently. See CanIUse

The only other option is to use an external plug-in like Flash or Silverlight to access the webcam.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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