Released version
Version number 6.4.2+1
FULL
Result of the command "flutter pub deps | grep flutter_sound"
(very important)
|-- flutter_sound 6.4.2+1
| |-- flutter_sound_platform_interface 6.4.2+1
| |-- flutter_sound_web 6.4.2+1
flutter: startRecorder
flutter: duration: 0
Describe the bug
Flutter Sound Recorder started and not null and behaves as expected on iOS simulator. However, when testing on physical iOS device, the recorder subscription outputs 0 for duration and db, which means that it is not properly recording audio on the device.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Sound Recorder should work as normal both on simulator and physical device.
Codec is pcm16WAV.
There's no log since the recorderModule is running and not null, however running on physical iOS device returns 0 db and duration. This is more observational and as of now I do not know where to pinpoint error log as it doesn't return an exception or error.
Hello, I have a similar error on the real IOS mobile phone. After the recording is turned on, monitor the method recorderModule.onProgress.listen () cannot listen to a valid recording time.
Getting media information for /var/mobile/Containers/Data/Application/7CAAB0B4-A125-431D-BFC9-1054B5FA4AA6/Library/Caches/flutter_ sound-1604932777.aac.
WARNING: Format aac detected only with low score of 1, misdetection possible!
Format aac detected only with low score of 1, misdetection possible!
/var/mobile/Containers/Data/Application/7CAAB0B4-A125-431D-BFC9-1054B5FA4AA6/Library/Caches/flutter_ sound-1604932777.aac: End of file
ERROR: /var/mobile/Containers/Data/Application/7CAAB0B4-A125-431D-BFC9-1054B5FA4AA6/Library/Caches/flutter_ sound-1604932777.aac: End of file
flutter: _ duration == 0.0
[VERBOSE-2:ui_ dart_ state.cc (177)] Unhandled Exception: NoSuchMethodError: The getter 'inMinutes' was called on null.
I have the same problem, duration aways 0 on IOS
We cannot do anything without more informations :
flutter pub deps | flutter_soundstartRecorder() parametersopenAudioSession() parametersAnd everything else you think can be useful to understand your issue.
Did you correctly requested the Recording permission before calling startRecorder() ?
It seems that several users have problems with the recorder.
I really think that the problem is that the API verbs are not called correctly, but it is hard for me tou understand without any logs. Be aware that the extension of the file (for example foo.wav) has no impact on the encoder used.
The encoder must be specified in the startRecorder() parameters.
I will try to return better errors when the parameters are incorrects. A crash is not a good error 😉
I keep this issue open, but please give more informations.
Just a simple question :
are you sure to have granted the Recording Permission before doing startRecorder() ?
Actually there is something not good in Flutter Sound : Flutter Sound does not return a correct error when the Recording Permission is not granted. This will be fixed soon.
Please check that you correctly grant the Recording Permission, and re-open this issue if you have still problems.
@Larpoux
I believe I have been able to reproduce this issue consistently.
Steps to reproduce:
openAudioSession(
mode: SessionMode.modeSpokenAudio,
focus: AudioFocus.requestFocus, //requestFocus may be related to the issue
category: SessionCategory.playAndRecord,
);
When using AudioFocus.requestFocusAndDuckOthers, the problem does not occur.
The logs link on the documentation is broken (https://tau.canardoux.xyz/guides_logs.html), can you tell me how to get the logs?
|-- flutter_sound_lite 7.5.3+1
| |-- flutter_sound_platform_interface 7.5.3+1
| |-- flutter_sound_web 7.5.3+1
Thank you @mhstoller for your investigations.
I am going to look to that next week.
I am currently rewriting asynchronous processing done by Ï„. This is a major change and tricky.
After the changes, we will be able to do :
myPlayer.openAudioSession(); // no need to wait
myPlayer.startPlayer(...); // no need to wait anymore the end of `openAudioSession()`
Also if the app is waiting on something (for example) :
await myPlayer.pausePlayer();
and the app does for example :
await myPlayer.pausePlayer(); // another call to the same function
or worst :
myPlayer.stopPlayer();
The first call to pausePlayer will receive an exception instead of being stuck for ever.
Ï„ is in the middle of two asynchronous clients : the OS and the App.
Managing asynchronous processing is really tough.
But I will look to your issue at the end of the week.
Any update on the status of this issue, or any workaround for the meanwhile?
Thanks!
Any update on the status of this issue, or any workaround for the meanwhile?
When you open the audio session try using a different focus parameter such as AudioFocus.requestFocusAndDuckOthers
As per your comment here, already tried but it didn't work.
Specifying SessionCategory.record along with AudioFocus.requestFocusAndDuckOthers seems to be working:
await _audioRecorder.openAudioSession(
focus: AudioFocus.requestFocusAndDuckOthers,
category: SessionCategory.record,
);