diff --git a/src/@ionic-native/plugins/camera-preview/index.ts b/src/@ionic-native/plugins/camera-preview/index.ts index 0867f2679..0dacbccc8 100644 --- a/src/@ionic-native/plugins/camera-preview/index.ts +++ b/src/@ionic-native/plugins/camera-preview/index.ts @@ -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} + */ + @Cordova({ + successIndex: 1, + errorIndex: 2 + }) + takeSnapshot(options?: CameraPreviewPictureOptions): Promise { + return; + } + /** * * Set camera color effect.