# RecorderManager.start(Object object)

Starts recording

# Parameters

# Object object

Property Type Default Value Required Description Minimum Version
duration number 60000 No Recording duration (in ms). The maximum value is 600,000 (10 minutes).
sampleRate number 8000 No Sampling rate
numberOfChannels number 2 No Number of recording channels
encodeBitRate number 48000 No Encoding bitrate. Valid values are shown in the following table.
format string aac No Audio format
frameSize number No Specifies the frame size (in KB). If this field is specified, the recorded file will be called back whenever reaching the specified frame size. If it is not specified, the recorded file will not be called back. Only MP3 format is supported.
audioSource string auto No Specifies the audio source for recording. Available audio sources can be obtained via wx.getAvailableAudioSources() 2.1.0

Valid values of object.sampleRate

Value Description Minimum Version
8000 8000 Hz sample rate
11025 11025 Hz sample rate
12000 12000 Hz sample rate
16000 16000 Hz sample rate
22050 22050 Hz sample rate
24000 24000 Hz sample rate
32000 32000 Hz sample rate
44100 44100 Hz sample rate
48000 48000 Hz sample rate

Valid values of object.numberOfChannels

Value Description Minimum Version
1 1 channel
2 2 channels

Valid values of object.format

Value Description Minimum Version
mp3 MP3 format
aac AAC format

Valid values of object.audioSource

Value Description Minimum Version
auto Automatic setup. The mobile microphone is used by default. The headset microphone is automatically adopted when the headset is plugged in. This setup applies to all platforms.
buildInMic Mobile microphone for iOS only
headsetMic Headset microphone for iOS only
mic Microphone (if the headset is not plugged in, the mobile microphone is used; otherwise, the headset microphone is used) for Android only
camcorder Same as mic. Suitable for audio and video recording. For Android only.
voice_communication Same as mic. Suitable for real-time communication. For Android only.
voice_recognition Same as mic. Suitable for speech recognition. For Android only.

# Limits to Sample Rate and Encoding Bitrate

Each sample rate has a valid range of encoding bitrates. An invalid sample rate or encoding bitrate will cause recording failure. The sample rates and their encoding bitrate are shown as follows.

Sample Rate Encoding Bitrate
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
点击咨询小助手