From 2fdbc4b881e7a7858679f460457276fd68915e46 Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Thu, 8 Jun 2023 20:23:44 +0200 Subject: [PATCH] fix: Add types for startRecordVideo and stopRecordVideo (#295) --- README.md | 5 ++--- src/definitions.ts | 2 ++ src/web.ts | 8 ++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2577c8c6..d3cc69bb 100644 --- a/README.md +++ b/README.md @@ -263,7 +263,7 @@ const CameraPreviewFlashMode: CameraPreviewFlashMode = 'torch'; CameraPreview.setFlashMode(cameraPreviewFlashMode); ``` -### startRecordVideo(options) ---- ANDROID only +### startRecordVideo(options) ---- ANDROID and iOS only Start capturing video
@@ -277,13 +277,12 @@ const cameraPreviewOptions: CameraPreviewOptions = { CameraPreview.startRecordVideo(cameraPreviewOptions); ``` -### stopRecordVideo() ---- ANDROID only +### stopRecordVideo() ---- ANDROID and iOS only Finish capturing a video. The captured video will be returned as a file path and the video format is .mp4
```javascript const resultRecordVideo = await CameraPreview.stopRecordVideo(); -this.stopCamera(); ``` ### setOpacity(options: CameraOpacityOptions): Promise<{}>; ---- ANDROID only diff --git a/src/definitions.ts b/src/definitions.ts index 9aa4a5fe..1e4efe00 100644 --- a/src/definitions.ts +++ b/src/definitions.ts @@ -60,7 +60,9 @@ export interface CameraOpacityOptions { export interface CameraPreviewPlugin { start(options: CameraPreviewOptions): Promise<{}>; + startRecordVideo(options: CameraPreviewOptions): Promise<{}>; stop(): Promise<{}>; + stopRecordVideo(): Promise<{}>; capture(options: CameraPreviewPictureOptions): Promise<{ value: string }>; captureSample(options: CameraSampleOptions): Promise<{ value: string }>; getSupportedFlashModes(): Promise<{ diff --git a/src/web.ts b/src/web.ts index 616cd78b..5f9bf913 100644 --- a/src/web.ts +++ b/src/web.ts @@ -98,6 +98,14 @@ export class CameraPreviewWeb extends WebPlugin implements CameraPreviewPlugin { }); } + async startRecordVideo(): Promise<{}> { + throw this.unimplemented('Not implemented on web.'); + } + + async stopRecordVideo(): Promise<{}> { + throw this.unimplemented('Not implemented on web.'); + } + async stop(): Promise { const video = document.getElementById('video'); if (video) {