HTML Media Capture
PUBLISHED
Media capture uses the capture attribute of the HTMLInputElement interface to activate features, such as camera or microphone, to enable direct media capture when the user is uploading a file.
This feature is supported in mobile applications only.
The following media formats can be used with the capture attribute:
filesystemActivates the device file picker.
cameraActivates the device camera.
camcorderActivates the device video camera.
microphoneActivates the device sound recorder.
Activating the Media Capture
To provide users with the HTML media capture feature, you must learn to activate the media capture feature by selecting the file type during file upload:
-
Activate the media capture feature by adding the
captureattribute to the<input>element:<input type="file" capture="filesystem"/>

-
Assign format, such as
filesystem,camera, orcamcorder:<input type="file" accept="audio/*" capture="camera"/> <input type="file" accept="image/*" capture="camcorder"/> <input type="file" accept="video/*" capture="microphone"/>
If the
captureattribute does not exist or the value has not been entered, thefilesystemformat is activated. If thecameraorcamcorderformat is selected, the device camera is activated.NoteIn the current version of the Tizen Studio, themicrophoneformat for the capture attribute is not available as the voice recorder application is not included.The
acceptattribute (in mobile and wearable applications) indicates which file types are appropriate. If used with a device that has a camera, it activates the device camera. With a device without a camera, it activates the My photo folder.
Source Code
For the complete source code related to this use case, see the following file:
Was this document helpful?
We value your feedback. Please let us know what you think.
