I want to record the sound coming from the Mic and Speaker. For this, I have used this plugin. but the problem is this only records the sound coming from mic, not the sound coming from speaker.
I want to achieve this for: I am developing an flutter app where users can call each other (audio call only) using agora rtc engine. And they can record their conversation locally. I know agora has cloud recording but I want to store the recording locally.
Please let me know if there is any other plugin that records the internal audio (Speaker sound and mic sound at the same time) or if I am doing anything wrong.
My code for recording:
var recorder = Record();
await recorder.start(
path: '/storage/emulated/0/Download/Test/recording.m4a',
encoder: AudioEncoder.aacLc,
bitRate: 128000,
samplingRate: 44100,
)
Agora.IO provides a build in function to record the session. This is how you can record the audio (Assuming you are already familiar with Agora and have successfully created RTC engine and initialized it):
void startAudioRecording() async {
var dateTime = DateTime.now();
currentRecordingName = "${dateTime.millisecondsSinceEpoch}";
try {
var dir = Directory(recordingPath);
if (!dir.existsSync()) await dir.create();
} catch (_) {}
isRecordingInProgress.value = true;
await rtcEngine.startAudioRecordingWithConfig(
AudioRecordingConfiguration(
"${recordingPath}Rec-$currentRecordingName.wav",
recordingPosition:
AudioRecordingPosition.PositionMixedRecordingAndPlayback,
recordingQuality: AudioRecordingQuality.High,
recordingSampleRate: AudioSampleRateType.Type48000,
),
);
}
And to stop the recording:
Future<void> stopAudioRecording() async {
await rtcEngine.stopAudioRecording();
isRecordingInProgress.value = false;
}