# RecorderManager.start(Object object)
with Promise style call: Not supported
Mini Program plugin: Support
Start recording.
# parameter
# Object object
attribute | type | Default values | Required | Introductions | Minimum version |
---|---|---|---|---|---|
duration | number | 60000 | no | Length of recording, unit Ms, maximum 600000(10 Minutes) | |
sampleRate | number | 8000 | no | Sampling rate (not supported by pc) | |
numberOfChannels | number | 2 | no | Number of recording channels | |
encodeBitRate | number | 48000 | no | Code rate, valid values are shown in the table below | |
format | string | aac | no | Audio format | |
frameSize | number | no | Specify frame size, in units KB。 to import frameSize Each time a specified frame size is recorded, the recorded file content will be called back, not specified, no callback. Support only temporarily mp3、pcm Format. | ||
audioSource | string | car | no | Specifies the audio input source for the recording, which can be accessed through the wx.getAvailableAudioSources() Get the currently available audio source | 2.1.0 |
object.sampleRate Legal value
value | Introductions | Minimum version |
---|---|---|
8000 | 8000 sampling rate | |
11025 | 11025 sampling rate | |
12000 | 12000 sampling rate | |
16000 | 16000 sampling rate | |
22050 | 22050 sampling rate | |
24000 | 24000 sampling rate | |
32000 | 32000 sampling rate | |
44100 | 44100 sampling rate | |
48000 | 48000 sampling rate |
object.numberOfChannels Legal value
value | Introductions | Minimum version |
---|---|---|
1 | 1 Channel | |
2 | 2 Channel |
object.format Legal value
value | Introductions | Minimum version |
---|---|---|
mp3 | mp3 format | |
aac | aac format | |
wav | wav format | |
PCM | pcm format |
object.audioSource Legal value
value | Introductions | Minimum version |
---|---|---|
car | Automatic settings, the default use of mobile phone microphone, plug in the headphone microphone automatically switch to use the microphone, all platforms | |
buildInMic | Mobile microphone, limited iOS | |
headsetMic | Wired headphone microphone, limited iOS | |
small | Microphone (mobile microphone when unplugged, headphone microphone when plugged in), limited Android | |
camcorder | with Mic, for recording audio and video content, limited Android | |
voice_communication | with Mic, for real-time communication, limited Android | |
voice_recognition | with Mic for speech recognition only Android |
# Sampling Rate and Code Rate Restriction
Each sampling rate has the corresponding valid value of the coding rate range, setting illegal sampling rate or coding rate will lead to recording failure, the specific corresponding relationship as follows.
sampling rate | Coding rate |
---|---|
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 |