feat(camera-preview): add wrapper for camera preview snapshot

This commit is contained in:
max-in-to 2019-05-09 21:14:27 -07:00
parent 25ef7c98bc
commit 79037743b8

View File

@ -113,6 +113,14 @@ export interface CameraPreviewPictureOptions {
* this.picture = 'assets/img/test.jpg';
* });
*
* // take a snap shot
* this.cameraPreview.takeSnapshot(this.pictureOpts).then((imageData) => {
* this.picture = 'data:image/jpeg;base64,' + imageData;
* }, (err) => {
* console.log(err);
* this.picture = 'assets/img/test.jpg';
* });
*
*
* // Switch camera
* this.cameraPreview.switchCamera();
@ -245,6 +253,20 @@ export class CameraPreview extends IonicNativePlugin {
return;
}
/**
* Take a snapshot of preview window (size specified in startCamera options)
* @param {CameraPreviewPictureOptions} [options] quality of the picture to take
* @return {Promise<any>}
*/
@Cordova({
successIndex: 1,
errorIndex: 2
})
takeSnapshot(options?: CameraPreviewPictureOptions): Promise<any> {
return;
}
/**
*
* Set camera color effect.