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

## 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, max 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, in bps. Default: 48000 |
| `format` | `"mp3" \| "aac" \| "wav" \| "PCM"` | No | `'aac'` | `2.3.2` | Audio format |
| `frameSize` | `number` | Yes | - | `2.3.2` | Specify frame size in KB. When frameSize is set, after each chunk of the specified size is recorded, a callback returns the recorded file content; if not set, no callbacks are triggered. Currently supports mp3 and pcm only. |
| `audioSource` | `string` | No | `"auto"` | `2.3.2` | Specify the audio input source for recording |
| `complete` | `() => void` | No | - | - | Completion callback (executed on both success and failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | - | Callback on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Failure callback |

#### 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` | Error extension code |
| `errorMsg` | `string` | Error extension message |


### Examples

#### Demo

```tsx
import { getRecorderManager } from '@ray-js/ray'

const manager = await 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);
  },
});
```
