RecorderManager.start
Start recording.
Parameters
Property | Type | Required | Description |
duration | Number | No | The recording duration, in ms. Max: 600000 (10 minutes) Default: |
format | String | No | The audio format. The value must be in lowercase. Valid values: Default: |
hideTips | Boolean | No | Whether to hide the recording icon. Default: |
numberOfChannels | Number | No | The number of recording channels. Valid values: Default: |
sampleRate | Number | No | The sampling rate. Valid values: Default:
|
encodeBitRate | Number | No | The encoding bitrate. The encoding bitrate must be configured based on the sampling rate you configure. For more information, see Encoding bitrate ranges Default:
|
audioSource | String | No | The audio input source for recording. You can call the my.getAvailableAudioSources API to get the available audio sources. Default: |
frameSize | Number | No | The frame size, in KB. The |
frameFormatPcm | Boolean | No | Whether the recorded audio frames should be formatted in Pulse Code Modulation (PCM). The |
Encoding bitrate ranges
Each sampling rate corresponds to a valid range of encoding bitrates. Setting an invalid sampling rate or encoding bitrate will result in a recording failure. The following table shows the correspondence:
Sampling rate | Encoding bitrate range |
8000 | 16000–48000 |
11025 | 16000–48000 |
12000 | 24000–64000 |
16000 | 24000–96000 |
22050 | 32000–128000 |
24000 | 32000–128000 |
32000 | 48000–192000 |
44100 | 64000–320000 |
48000 | 64000–320000 |
Sample code
const recorderManager = my.getRecorderManager();
recorderManager.start({
duration: 60000,
});