Tau: [BUG] Recorder not working

Created on 9 Nov 2020  Â·  14Comments  Â·  Source: Canardoux/tau

Flutter Sound Version :

  • 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_sound_platform_interface...

Severity

  • Result is not what expected

Platforms you faced the error

  • iOS
  • Real Device

Logs

flutter: startRecorder
flutter: duration: 0

flutter: db: 0.00015999999999999999

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:

  1. Test and run app on physical iOS device
  2. Check db and duration from recorder on progress subscription, which outputs 0 instead of expected actual values from recording.
  3. Sound file not recorded and empty.

Expected behavior
Sound Recorder should work as normal both on simulator and physical device.


maybe bug New

All 14 comments

  • Which codec ?
  • We need logs.

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.

Because of this, the recording cannot be ended and stored normally, resulting in the following errors:

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.

Receiver: null

I have the same problem, duration aways 0 on IOS

We cannot do anything without more informations :

  • Result of flutter pub deps | flutter_sound
  • THE LOGS (very important)
  • Which Codec (pcm16WAV ?)
  • The startRecorder() parameters
  • The openAudioSession() parameters

And 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:

  1. Use openAudioSession with AudioFocus.requestFocus on an iOS device
  2. Record audio
  3. Playback audio (sometimes this is not required for the bug to occur, I'm not sure why)
  4. Try to record another audio file (it will have a duration of 0.00015999999999999999 and decibel level of 0)
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,
    );

Was this page helpful?
0 / 5 - 0 ratings