startAudioRecording method
Future<void>
startAudioRecording(
- String filePath,
- AudioSampleRateType sampleRate,
- AudioRecordingQuality quality
Starts an audio recording on the client.
The 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 the recording file are as follows:
- .wav: Large file size with high fidelity.
- .aac: Small file size with low fidelity.
Note
- Ensure that the directory to save the recording file exists and is writable.
- This method is usually called after calling the RtcEngine.joinChannel method. The recording automatically stops when you call the RtcEngine.leaveChannel method.
- For better recording effects, set quality as AudioRecordingQuality.Medium or AudioRecordingQuality.High when sampleRate is 44.1 kHz or 48 kHz.
Parameter filePath
Absolute file path (including the suffixes of the filename) of the recording file. The string of the file name is in UTF-8. For example, /sdcard/emulated/0/audio/aac
.
Parameter sampleRate
Sample rate (Hz) of the recording file. See AudioSampleRateType for supported values.
Parameter quality
The audio recording quality. See AudioRecordingQuality.
Implementation
@override
Future<void> startAudioRecording(String filePath,
AudioSampleRateType sampleRate, AudioRecordingQuality quality) {
return _invokeMethod('startAudioRecording', {
'filePath': filePath,
'sampleRate': AudioSampleRateTypeConverter(sampleRate).value(),
'quality': AudioRecordingQualityConverter(quality).value()
});
}