I am trying to create a phonegap app to capture image with its camera. When i googled, i got two options ie using camera api and capture api.
what is the difference between navigator.device.capture.captureImage(captureSuccess, captureError, options)
and navigator.device.camera.getPicture(captureSuccess, captureError, options)
A Plugin Camera is required to access the camera functionality of a device. This plugin enables a user to take any picture from the device and accessthe files from the image gallery. If you want to show a picture to the user, you can use FILEURI or DATAURI object.
getPicture. Takes a photo using the camera or retrieves a photo from the device's album. The image is returned as a base64 encoded String or as the URI of an image file.
This plugin defines a global navigator. camera object, which provides an API for taking pictures and for choosing images from the system's image library. Although the object is attached to the global scoped navigator , it is not available until after the deviceready event.
I don't know if there is still a difference, but in 2012 there were differences like you can see here: Get and Capture Differences
Camera.getPicture has a bunch of options that capture.captureImage does not. The other difference is capture follows a W3C spec while our camera spec is home grown.
As i have just seen the captureImage
command is from the PhoneGap Documentation
The getPicture
command is from the Cordova Camera Plugin
I noticed one difference.
navigator.device.capture.captureImage(captureSuccess, captureError, options)
on success save the image to default camera location where as
navigator.device.camera.getPicture(captureSuccess, captureError, options)
on success returns image as Base64 string
using navigator.device.capture we can also capture other media like audio(navigator.device.capture.captureAudio(captureSuccess, captureError, {limit: 1})
) and video (navigator.device.capture.captureVideo(captureSuccess, captureError, {limit: 1})
) which alse on success,saved to default location
cordova-plugin-media-capture capture.captureImage only supports one option {limit : 1}
Provide option to capture audio and video as well.
Provide multiple capture
On other side cordova-plugin-camera support number of custom options for capturing a image
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With