Input file - capture
<input type="file" capture="environment | user">
Parameter :
user - The user-facing camera and/or microphone should be used. environment - The outward-facing camera and/or microphone should be used
Example :
# Opens back facing camera to take video <input type="file" capture="environment" accept="video/*"> # Opens front facing camera to take photo <input type="file" capture="user" accept="image/*">
The capture attribute specifies that, optionally, a new file should be captured, and which device should be used to capture that new media of a type defined by the accept attribute.
Values include user and environment. The capture attribute is supported on the file input type.
The capture attribute takes as its value a string that specifies which camera to use for capture of image or video data, if the accept attribute indicates that the input should be of one of those types.
Note these work better on mobile devices; if your device is a desktop computer, you'll likely get a typical file picker.