Closed Catobleppa closed 4 years ago
I believe that I've found the source of the problem.
In the java file FlutterSoundPlugin line: 255: path = PathUtils.getDataDirectory(reg.context()) + "/" + path;
So if you pass in an absolute path there are likely to be a couple of issues: e.g. /somepath/file.wav 1) you end up with double // after the above concatenation. 2) there is a chance that you end up with a file path that is too long (max len is 255 bytes).
I also note that the code has a comment: // SDK 29 : you may not write in getExternalStorageDirectory
Yes, you are not allowed to write to the sdcard since Android 29. If you want to support last Android SDK you must change that. With the next flutter_sound version, you will be allowed to specify the complete path where you want to record. I think it can help.
For the '//', I do not think it was a problem. But we use now a temporary directory instead of the sdcard.
Hyo will correct me if I am wrong in this comment.
@hyochan : I think that you can close this issue. Now, flutter_sound needs a complete path for startRecorder() and startPlayer(). Flutter_sound does not do anymore special things on this path. If iOS or Android are OK to write on this path, flutter_sound will be pleased.
Please feel free to re-open this issue if you think that your problem is not fixed by recent version.
Version of flutter_sound
2.0.1
flutter doctor
all green
Platforms you faced the error (IOS or Android or both?)
Android
Expected behavior
Record file to external storage
Actual behavior
Recorder never starts recording
Tested environment (Emulator? Real Device?)
both emulator and real device
Steps to reproduce the behavior
I'm trying to record audio to an external folder. The app has access to external storage, and it can write a txt file just fine, but it can't record an audio file. Tried multiple extensions (mp3, aac, even wav) but none of them work. The recorder works if i leave it without parameters or if i only specify the file name. It used to work before androidX with the same setup.