WARNING: Collection and use of images, video, or audio from the device’s camera or microphone raises important privacy issues. Your app’s privacy policy should discuss how the app uses such sensors and whether the data recorded is shared with any other parties. In addition, if the app’s use of the camera or microphone is not apparent in the user interface, you should provide a just-in-time notice before the app accesses the camera or microphone (if the device operating system doesn’t do so already). That notice should provide the same information noted above, as well as obtaining the user’s permission (e.g., by presenting choices for OK and No Thanks). Note that some app marketplaces may require your app to provide just-in-time notice and obtain permission from the user prior to accessing the camera or microphone. For more information, please see the Privacy Guide.
Objects
- Capture
- CaptureAudioOptions
- CaptureImageOptions
- CaptureVideoOptions
- CaptureCallback
- CaptureErrorCB
- ConfigurationData
- MediaFile
- MediaFileData
Methods
- capture.captureAudio
- capture.captureImage
- capture.captureVideo
- MediaFile.getFormatData
Properties
- supportedAudioModes: The audio recording formats supported by the device. (ConfigurationData[])
- supportedImageModes: The recording image sizes and formats supported by the device. (ConfigurationData[])
- supportedVideoModes: The recording video resolutions and formats supported by the device. (ConfigurationData[])
Note: For further examples for each method please visit the source documentation.
Simple Image Capture Example(Shows image path)
// capture callback
captureSuccess = function(mediaFiles) {
var i, path, len;
var media=””;
for (i = 0, len = mediaFiles.length; i < len; i += 1) {
media += “<p><strong> “+mediaFiles[i].fullPath+”<strong></p>”;
}
document.getElementById(“imageInfo”).innerHTML = media;
};
// capture error callback
captureError = function(error) {
alert(‘Error code: ‘ + error.code, null, ‘Capture Error’);
};
// start image capture
startImageCapture = function() {
navigator.device.capture.captureImage(captureSuccess, captureError, null);
};
Source Documentation:
http://plugins.cordova.io/#/package/org.apache.cordova.media-capture