Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phonegap :difference between capture.captureImage and camera.getPicture

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)

like image 260
Sonia John Kavery Avatar asked Apr 22 '15 08:04

Sonia John Kavery


People also ask

What is camera plugin?

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.

What is camera getPicture?

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.

What is camera plugin in Cordova?

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.


3 Answers

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

like image 128
Sithys Avatar answered Nov 15 '22 09:11

Sithys


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

like image 31
Sonia John Kavery Avatar answered Nov 15 '22 10:11

Sonia John Kavery


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

like image 25
PPB Avatar answered Nov 15 '22 09:11

PPB