startAudioRecording [2/3]
Starts audio recording on the client and sets the sample rate of recording.
virtual int startAudioRecording(const char* filePath,
int sampleRate,
AUDIO_RECORDING_QUALITY_TYPE quality) = 0;
Details
The Agora SDK allows recording during a call. After successfully calling this method, you can record the audio of all the users in the channel and get an audio recording file. Supported formats of audio files are as follows:
- .wav: Large file size with high fidelity.
- .aac: Small file size with low fidelity.
Attention:
- Ensure that the directory you use to save the recording file exists and is writable.
- This method should be called after the joinChannel [2/2] method. The recording automatically stops when you call the leaveChannel [2/2] method.
- For better recording effects, set quality to AUDIO_RECORDING_QUALITY_MEDIUM or AUDIO_RECORDING_QUALITY_HIGH when sampleRate is 44.1 kHz or 48 kHz.
Parameters
- filePath
- The absolute path (including the filename extensions) of the recording file. For example:
C:\music\audio.aac
.Attention:Ensure that the directory for the log files exists and is writable.
- sampleRate
-
The sample rate (kHz) of the recording file. Supported values are as follows:
- 16000
- (Default) 32000
- 44100
- 48000
- quality
- Recording quality. See AUDIO_RECORDING_QUALITY_TYPE.
Returns
- 0: Success.
- < 0: Failure.