Closed mregnauld closed 1 year ago
After further investigation, it appears that if I do File(path).existsSync()
(in the _stop()
function, with the path
returned by _audioRecorder.stop()
), it always returns false (even though I can use it with audioplayers
.
So I tried the following:
final directory = await getApplicationDocumentsDirectory();
final audioFile = File("${directory.path}/audio/test.m4a");
await _audioRecorder.start(
path: audioFile.path,
encoder: AudioEncoder.aacLc,
bitRate: 128000,
samplingRate: 44100,
numChannels: 2,
);
but even here, File(path).existsSync()
still returns false. And audioplayers
doesn't work anymore.
So how can I access the generated audio file so I can copy and save it elsewhere?
Any help would be highly appreciated.
Use File.fromUri(Uri.parse(path))
.
This issue should be fixed in v5
Awesome! Thank you! Is there a documentation available for the current v5 beta?
Also FYI, I noticed that the following sampling rate only works for Android, not on iOS:
await _audioRecorder.start(
bitRate: 128000,
samplingRate: 22050, // doesn't work on iOS
numChannels: 2,
);
And if I use 44100
for the sampling rate, it works but I always have an artefact in the beginning of the sound, like a drum kick.
This should be fixed also in next v5.
Great! Can't wait! Thank you!
Is the 22kHz sampling rate 22000 or 22050?
Package version 4.4.4
Describe the bug When the audio recorder has finished recording, I got a path returned by
stop()
. But when I try to access the file with that path, the file doesn't exist. Only occurs on iOS, no problem on Android. (That being said, it did work before, surprisingly.)To Reproduce Steps to reproduce the behavior:
_buildRecordStopControl()
below, there is a button that allows to start and stop recording_stop()
is called, the path infinal path = await _audioRecorder.stop();
doesn't existExpected behavior I should be able to access the generated audio file.
Smartphone (please complete the following information):
Additional context Here is the full code: