Open skuzakov-voc opened 2 years ago
I'm facing a similar issue after upgrading from 8.5.0
to 9.2.10
. It works fine on the simulator, but on a real iOS device, it does not. In my case, I end up with file sizes of zero bytes, however.
On some investigation, I found that progress does not increment. When I listen to progress with
_myRecorder?.onProgress?.listen((event) {
debugPrint('onProgress $event');
});
I get this output infinitely:
flutter: onProgress duration: 0:00:00.000000 decibels: 0.00015999999999999999
flutter: onProgress duration: 0:00:00.000000 decibels: 0.00015999999999999999
flutter: onProgress duration: 0:00:00.000000 decibels: 0.00015999999999999999
...
I found writing to files in iOS 15.4.x devices caused issues -- not sure if that's related.
Same issue, Mine records at first and when I close the session It can't record after openning session again. Basically, this is what happends:
1 - Open Recording Session -> Works 2 - Record -> Works 3 - Stop, Close Sesssion ->Works 4 - Go to next screen, Open recording session -> No reaction from flutter_sound and no recording listened...
Perhaps you can try to configure your audio session with the audio_session plugin before startRecorder(). See [#890] and [#868]
Also, your logs would be helpful
I downgraded flutter_sound to 8.5.0 and audio recording on the real ios device started working.
This issue is stale because it has been open 90 days with no activity. Leave a comment or this will be closed in 7 days.
same issue
Are you sure to open an audio session with a federating tool like Audio Session ? The documentation is really bad on this point, but this is really mandatory, specially with recorders on iOS.
final session = await AudioSession.instance;
await session.configure(AudioSessionConfiguration(
avAudioSessionCategory: AVAudioSessionCategory.playAndRecord,
avAudioSessionCategoryOptions:
AVAudioSessionCategoryOptions.allowBluetooth |
AVAudioSessionCategoryOptions.defaultToSpeaker,
avAudioSessionMode: AVAudioSessionMode.spokenAudio,
avAudioSessionRouteSharingPolicy:
AVAudioSessionRouteSharingPolicy.defaultPolicy,
avAudioSessionSetActiveOptions: AVAudioSessionSetActiveOptions.none,
androidAudioAttributes: const AndroidAudioAttributes(
contentType: AndroidAudioContentType.speech,
flags: AndroidAudioFlags.none,
usage: AndroidAudioUsage.voiceCommunication,
),
androidAudioFocusGainType: AndroidAudioFocusGainType.gain,
androidWillPauseWhenDucked: true,
));
this is my
void _startRecording() async {
if (_mRecorder == null || !_mRecorderIsInited) {
print("Recorder is not initialized or null");
return;
}
try {
print("Starting recorder...");
await _mRecorder!.startRecorder(
toFile: _mPath,
codec: _codec,
numChannels: 1,
audioSource: theSource,
);
print("Recording started");
setState(() {});
if (_mRecorder!.onProgress != null) {
print("Its on progress");
_mRecorder!.onProgress!.listen((e) {
print("Trying to listen to progress: ${e.duration.inMilliseconds}");
setState(() {
_timer =
DateTime.fromMillisecondsSinceEpoch(e.duration.inMilliseconds)
.millisecond;
});
});
} else {
print("onProgress is null");
}
} catch (e) {
print("Error starting recorder: $e");
}
}
and this is the prints I get , on simulator flutter: Recording started flutter: Its on progress
the recorder is working fine and I can get the file normal , but I want to show the duration , but it never works
Did you call setSubscriptionDuration(duration)
?
Flutter Sound Version :
FULL or LITE flavor ? Full
Important: Result of the command :
flutter pub deps | grep flutter_sound
Severity
Crash ?
Result is not what expected ? [x]
Cannot build my App ?
Minor issue ?
Platforms you faced the error
iOS ? [x]
Android ?
Flutter Web ?
Emulator ?
Real device ? [x]
Describe the bug We use FlutterSoundRecorder to record audio and save to temporary directory. Recorder works fine on iOS simulator but does not work on real iOS device. On real devices recorded file length always equals to 4096. No errors in logs. Flutter_sound used along with audio_service library for control with bluetooth devices. Android also works fine.
To Reproduce Steps to reproduce the behavior:
See that record file is always 4096b and can not be played
Logs!!!!
(This is very important. Most of the time we cannot do anything if we do not have information on your bug). To activate the logs, you must instantiate your modules with the Log Level set to
Level.debug
:See this