---
name: "CameraContext.startRecord"
mode: "api"
versionRequirements:
  - { name: "Base Library", version: "2.21.8" }
title: "CameraContext.startRecord"
---

## CameraContext.startRecord

> [VERSION] Base Library >= 2.21.8

### Description

Start recording

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `option` | `CameraStartRecordOption` | Yes | Recording options |

### Return Value

None


### Referenced Types

##### `interface` CameraStartRecordOption

| Property | Type | Description |
| --- | --- | --- |
| `timeoutCallback` | `() => void` | Timeout callback |
| `timeout` | `number` | Timeout, in ms |
| `selfieMirror` | `boolean` | Whether to enable selfie mirroring |
| `success` | `() => void` | Success callback |
| `fail` | `(result: CameraFailResult) => void` | Callback on failure |
| `complete` | `() => void` | Callback on complete (success or failure) |

##### `interface` CameraFailResult

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string` | Error code |
| `errorMsg` | `string` | Error message |


### Examples

#### Start recording

```ts
const cameraCtx = ty.createCameraContext();
cameraCtx.startRecord({
  timeout: 30000,
  success() {
    console.log('Recording started');
  },
  timeoutCallback() {
    console.log('Recording timed out');
  },
});
```
