2021-02-20 09:07:10 -07:00
|
|
|
import type { CameraCaptureError } from './CameraError';
|
|
|
|
import type { TemporaryFile } from './TemporaryFile';
|
2021-02-19 08:07:53 -07:00
|
|
|
|
2021-05-06 06:11:55 -06:00
|
|
|
export type VideoFileType = 'mov' | 'avci' | 'm4v' | 'mp4';
|
|
|
|
|
2021-12-30 02:47:23 -07:00
|
|
|
export type CameraVideoCodec =
|
|
|
|
| 'h264'
|
|
|
|
| 'hevc'
|
|
|
|
| 'hevc-alpha'
|
|
|
|
| 'jpeg'
|
|
|
|
| 'pro-res-4444'
|
|
|
|
| 'pro-res-422'
|
|
|
|
| 'pro-res-422-hq'
|
|
|
|
| 'pro-res-422-lt'
|
|
|
|
| 'pro-res-422-proxy';
|
|
|
|
|
2021-02-19 08:07:53 -07:00
|
|
|
export interface RecordVideoOptions {
|
|
|
|
/**
|
|
|
|
* Set the video flash mode. Natively, this just enables the torch while recording.
|
|
|
|
*/
|
2021-02-20 09:07:10 -07:00
|
|
|
flash?: 'on' | 'off' | 'auto';
|
2021-05-06 06:11:55 -06:00
|
|
|
/**
|
|
|
|
* Sets the file type to use for the Video Recording.
|
|
|
|
* @default "mov"
|
|
|
|
*/
|
|
|
|
fileType?: VideoFileType;
|
2021-02-19 08:07:53 -07:00
|
|
|
/**
|
|
|
|
* Called when there was an unexpected runtime error while recording the video.
|
|
|
|
*/
|
|
|
|
onRecordingError: (error: CameraCaptureError) => void;
|
|
|
|
/**
|
|
|
|
* Called when the recording has been successfully saved to file.
|
|
|
|
*/
|
|
|
|
onRecordingFinished: (video: VideoFile) => void;
|
2021-12-30 02:47:23 -07:00
|
|
|
/**
|
|
|
|
* Set the video codec to record in. Different video codecs affect video quality and video size.
|
|
|
|
* To get a list of all available video codecs use the `getAvailableVideoCodecs()` function.
|
|
|
|
*
|
|
|
|
* @default undefined
|
2021-12-31 04:33:21 -07:00
|
|
|
* @platform iOS
|
2021-12-30 02:47:23 -07:00
|
|
|
*/
|
|
|
|
videoCodec?: CameraVideoCodec;
|
2021-02-19 08:07:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents a Video taken by the Camera written to the local filesystem.
|
2021-03-08 10:21:30 -07:00
|
|
|
*
|
2021-03-08 10:51:53 -07:00
|
|
|
* Related: {@linkcode Camera.startRecording | Camera.startRecording()}, {@linkcode Camera.stopRecording | Camera.stopRecording()}
|
2021-02-19 08:07:53 -07:00
|
|
|
*/
|
2021-03-08 09:51:47 -07:00
|
|
|
export interface VideoFile extends TemporaryFile {
|
|
|
|
/**
|
|
|
|
* Represents the duration of the video, in seconds.
|
2021-03-18 05:18:57 -06:00
|
|
|
*
|
2021-06-21 14:42:46 -06:00
|
|
|
* This is `undefined` on Android, see [issue #77](https://github.com/mrousavy/react-native-vision-camera/issues/77)
|
2021-03-18 05:18:57 -06:00
|
|
|
*
|
|
|
|
* @platform iOS
|
2021-03-08 09:51:47 -07:00
|
|
|
*/
|
2021-03-18 05:18:57 -06:00
|
|
|
duration?: number;
|
2021-03-08 09:51:47 -07:00
|
|
|
}
|