Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]Error Code -2 Thrown When Attempting Local Audio Recording in Agora sdk Flutter #162

Open
supunnilakshana opened this issue Oct 29, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@supunnilakshana
Copy link

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 startRecord() async {
Directory? tempDir = await getExternalStorageDirectory();
String tempPath = tempDir!.path;

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.

@supunnilakshana supunnilakshana added the bug Something isn't working label Oct 29, 2023
@supunnilakshana supunnilakshana changed the title [BUG]Error Code -2 Thrown When Attempting Local Audio Recording in Flutter [BUG]Error Code -2 Thrown When Attempting Local Audio Recording in Agora sdk Flutter Oct 29, 2023
@Meherdeep
Copy link
Contributor

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants