interface RecordVideoOptions {
    fileType?: "mov" | "mp4";
    flash?: "off" | "on";
    onRecordingError: ((error) => void);
    onRecordingFinished: ((video) => void);
    path?: string;
    videoBitRate?: number | "normal" | "low" | "high" | "extra-low" | "extra-high";
    videoCodec?: "h264" | "h265";
}

Properties

fileType?: "mov" | "mp4"

Specifies the output file type to record videos into.

flash?: "off" | "on"

Set the video flash mode. Natively, this just enables the torch while recording.

onRecordingError: ((error) => void)

Called when there was an unexpected runtime error while recording the video.

Type declaration

onRecordingFinished: ((video) => void)

Called when the recording has been successfully saved to file.

Type declaration

    • (video): void
    • Parameters

      Returns void

path?: string

A custom path where the video will be saved to.

This must be a directory, as VisionCamera will generate a unique filename itself. If the given directory does not exist, this method will throw an error.

By default, VisionCamera will use the device's temporary directory.

videoBitRate?: number | "normal" | "low" | "high" | "extra-low" | "extra-high"

The bit-rate for encoding the video into a file, in Mbps (Megabits per second).

Bit-rate is dependant on various factors such as resolution, FPS, pixel format (whether it's 10 bit HDR or not), and video codec.

By default, it will be calculated by the hardware encoder, which takes all those factors into account.

  • extra-low: 40% lower than whatever the hardware encoder recommends.
  • low: 20% lower than whatever the hardware encoder recommends.
  • normal: The recommended value by the hardware encoder.
  • high: 20% higher than whatever the hardware encoder recommends.
  • extra-high: 40% higher than whatever the hardware encoder recommends.
  • number: Any custom number for the bit-rate, in Mbps.

Default

'normal'
videoCodec?: "h264" | "h265"

The Video Codec to record in.

  • h264: Widely supported, but might be less efficient, especially with larger sizes or framerates.
  • h265: The HEVC (High-Efficient-Video-Codec) for higher efficient video recordings. Results in up to 50% smaller file-sizes.