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

feat(camera-preview): add wrapper for camera preview snapshot
This commit is contained in:
Daniel Sogl 2019-05-16 06:56:00 +02:00 committed by GitHub
commit 56e4a7827f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,6 +113,14 @@ export interface CameraPreviewPictureOptions {
* this.picture = 'assets/img/test.jpg'; * 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 * // Switch camera
* this.cameraPreview.switchCamera(); * this.cameraPreview.switchCamera();
@ -245,6 +253,20 @@ export class CameraPreview extends IonicNativePlugin {
return; 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. * Set camera color effect.