VideoUIKit-Flutter
VideoUIKit-Flutter copied to clipboard
[BUG]Error Code -2 Thrown When Attempting Local Audio Recording in Agora sdk Flutter
Error Code -2 Thrown When Attempting Local Audio Recording in Flutter
Description: When attempting to initiate local audio recording in a Flutter application, the startRecord() method encounters error code -2. The issue arises despite the fact that other aspects of the code are functioning correctly.
My Code:
Future
await agoraClient.engine.startAudioRecording(AudioRecordingConfiguration(
filePath: "$tempPath/dd/rec1.acc",
encode: false,
fileRecordingType: AudioFileRecordingType.audioFileRecordingMic,
quality: AudioRecordingQualityType.audioRecordingQualityLow,
recordingChannel: 1,
sampleRate: 16000));
}
The code provided successfully initializes local audio recording in the Flutter application. The error occurs during the execution of the startAudioRecording method. The error code -2 is being thrown at this point. Expected Behavior: The startRecord() method should be able to initiate local audio recording without encountering error code -2.
Environment Information:
Flutter version: Agora Flutter SDK version: Android/iOS version (if applicable): Any other relevant environment information. Steps to Reproduce:
Provide the necessary environment and setup details. Execute the startRecord() method. Observe the error code -2 being thrown.
Can you please check the path that you're using is the absolute path to the directory. Also, a quick note the getExternalStorageDirectory works only on Android and not on iOS (as mentioned in the docs: https://pub.dev/documentation/path_provider/latest/path_provider/getExternalStorageDirectory.html)