I am writing a web app which allows the user to take photos with their mobile device. These photos must be taken live, in real-time and not uploaded from e.g. previous photos taken or saved jpg images.
I currently have 2 different prototypes:
- Using getUserMedia() to check for valid devices, force user to allow device access and open a video stream, then capture the stream image to a canvas for further processing.
- Using
<input type="file" accept="image/*" capture="camera" />
to get access to a mobile device’s camera app, then return the photo taken as an image file for further processing.
I like the <input type="file" accept="image/*" capture="camera" />
solution because of the ease of implementation and the camera app UX and functions are so much better than a simple getUserMedia() solution. Also, a fully functional getUserMedia() solution (with, e.g. flash, focus, zoom, fullscreen, etc.) seems like it would be very complex to implement.
BUT…
Some platforms (e.g. PC) allow selection of the image file from folder instead of using the camera device.
This is a showstopper for me.
Is it possible to know whether the device being used is going to allow selection of an image file vs. open the camera app, or perhaps the source of the image when it is returned, so that I can prevent use of images from folders?
Thanks for any advice!