Skip to content

Commit

Permalink
fix: Add types for startRecordVideo and stopRecordVideo (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Jun 8, 2023
1 parent 2003f75 commit 2fdbc4b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ const CameraPreviewFlashMode: CameraPreviewFlashMode = 'torch';
CameraPreview.setFlashMode(cameraPreviewFlashMode);
```
### startRecordVideo(options) ---- ANDROID only
### startRecordVideo(options) ---- ANDROID and iOS only
<info>Start capturing video</info><br/>
Expand All @@ -277,13 +277,12 @@ const cameraPreviewOptions: CameraPreviewOptions = {
CameraPreview.startRecordVideo(cameraPreviewOptions);
```
### stopRecordVideo() ---- ANDROID only
### stopRecordVideo() ---- ANDROID and iOS only
<info>Finish capturing a video. The captured video will be returned as a file path and the video format is .mp4</info><br/>
```javascript
const resultRecordVideo = await CameraPreview.stopRecordVideo();
this.stopCamera();
```
### setOpacity(options: CameraOpacityOptions): Promise<{}>; ---- ANDROID only
Expand Down
2 changes: 2 additions & 0 deletions src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<{
Expand Down
8 changes: 8 additions & 0 deletions src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<any> {
const video = <HTMLVideoElement>document.getElementById('video');
if (video) {
Expand Down

2 comments on commit 2fdbc4b

@mario-deaconescu
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has ios video recording been added? I don't see any commits mentioning it.

@alexandargyurov
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.