---
name: "RecorderManager.start"
mode: "kit"
versionRequirements:
  - { name: "BaseKit", version: "2.3.2" }
platform:
  - "iOS"
  - "Android"
title: "RecorderManager.start"
---

## RecorderManager.start

> [VERSION] BaseKit >= 2.3.2

> [PLATFORM] iOS, Android

### Description

Start recording

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `duration` | `number` | No | `60000` | `2.3.2` | Recording duration in ms, maximum 600000 (10 minutes) |
| `sampleRate` | `8000 \| 11025 \| 12000 \| 16000 \| 22050 \| 24000 \| 32000 \| 44100 \| 48000` | No | `8000` | `2.3.2` | Sample rate |
| `numberOfChannels` | `1 \| 2` | No | `2` | `2.3.2` | Number of channels |
| `encodeBitRate` | `number` | No | `48000` | `2.3.2` | Encoding bitrate (bps), default 48000 |
| `format` | `"mp3" \| "aac" \| "wav" \| "PCM"` | No | `'aac'` | `2.3.2` | Audio format |
| `frameSize` | `number` | Yes | - | `2.3.2` | Specify the frame size in KB. If frameSize is provided, the recorded file content is returned after each frame of the specified size; if omitted, no callback is triggered. Currently supports mp3 and pcm only. |
| `audioSource` | `string` | No | `"auto"` | `2.3.2` | Specify the audio input source for recording |
| `complete` | `() => void` | No | - | - | Callback when the API call completes (invoked on both success and failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | - | Callback invoked on success |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Callback invoked on failure |

#### success callback parameters

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `tempFilePath` | `string` | `3.2.6` | Temporary path of the recording file (local path) |

#### fail callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `errorMsg` | `string` | Error message |
| `errorCode` | `string \| number` | Error code |
| `innerError` | `Object` | Error extension |

##### fail(params).innerError properties

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Extended error code |
| `errorMsg` | `string` | Extended error info |


### Valid Values

##### `sampleRate` valid values

| Value | Description |
| --- | --- |
| `8000` | 8,000 Hz sample rate |
| `11025` | 11,025 Hz sample rate |
| `12000` | 12,000 Hz sample rate |
| `16000` | 16,000 Hz sample rate |
| `22050` | 22,050 Hz sample rate |
| `24000` | 24,000 Hz sample rate |
| `32000` | 32,000 Hz sample rate |
| `44100` | 44,100 Hz sample rate |
| `48000` | 48,000 Hz sample rate |

##### `numberOfChannels` valid values

| Value | Description |
| --- | --- |
| `1` | Mono |
| `2` | Stereo |

##### `format` valid values

| Value | Description |
| --- | --- |
| `"mp3"` | MP3 format (not supported on iOS yet) |
| `"aac"` | AAC format |
| `"wav"` | WAV format |
| `"PCM"` | PCM format |


### Examples

```tsx
const manager = await ty.getRecorderManager();

manager.start({
  duration: 60000,
  sampleRate: 8000,
  numberOfChannels: 2,
  encodeBitRate: 48000,
  format: "aac",
  frameSize: 1,
  audioSource: "auto",
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});
```
