diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts index af0499f38..a9edfc5bc 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -21,6 +21,52 @@ export interface CameraPreviewSize { * * For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview). * + * @usage + * ``` + * import { CameraPreview } from 'ionic-native'; + * + * // camera options (Size and location) + * let cameraRect: CameraPreviewRect = { + * x: 100, + * y: 100, + * width: 200, + * height: 200 + * }; + * + * + * // start camera + * CameraPreview.startCamera( + * cameraRect, // position and size of preview + * 'front', // default camera + * true, // tape to take picture + * false, // disable drag + * true // send the preview to the back of the screen so we can add overlaying elements + * ); + * + * // Set the handler to run every time we take a picture + * CameraPreview.setOnPictureTakenHandler().subscribe((result) => { + * console.log(result); + * // do something with the result + * }); + * + * + * // take a picture + * CameraPreview.takePicture({ + * maxWidth: 640, + * maxHeight: 640 + * }); + * + * // Switch camera + * CameraPreview.switchCamera(); + * + * // set color effect to negative + * CameraPreview.setColorEffect('negative'); + * + * // Stop the camera preview + * CameraPreview.stopCamera(); + * + * ``` + * */ @Plugin({ plugin: 'cordova-plugin-camera-preview', @@ -42,9 +88,7 @@ export class CameraPreview { @Cordova({ sync: true }) - static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void { - - }; + static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void { }; /** * Stops the camera preview instance.