Skip to content

Long voice recordings truncated to just 1–3 #644

Closed

Description

@devbrisk

Package version
7.1.2

Environment

  • OS: Android

Describe the bug
Sometimes long voice recordings get truncated to just 1–3 seconds.
This issue has occurred for many users. Interestingly, I have never been able to reproduce it myself, either on an emulator or on my Xiaomi phone.
Some of our users have reported this issue, particularly on Samsung with Android 16 phones.

Add your record configuration RecordConfig(...)
const RecordConfig(
encoder: AudioEncoder.aacLc,
bitRate: 64000,
numChannels: 1,
sampleRate: 44100,
autoGain: true,
echoCancel: true,
noiseSuppress: true,
)

Activity

  1. llfbandit commented on Nov 9, 2026

    @llfbandit
    Owner

    Thanks for the report.

    Could you check:

    • Is the bad recording really 1-3 seconds, or the time of recording with silence (or noise)? Or sometimes, it is longer but still "truncated"?
    • Do you subcribe to state stream to know if the recording has been stopped or paused?
    • You left audioInterruption to .pause (the default). You can try with .none (recommended for diagnostic) or .pauseResume.
    • Is the app in background while recording? If so, the issue is irrelant here, this is not supported by this package directly.

    The file seems playable, so for now I strongly assume that the recording is just paused and never resumed.
    Either way, you should listen to onStateChanged() so your UI reflects the actual recorder state.

    To keep the take going, you could set audioInterruption to .none and AndroidRecordConfig.muteAudio to true (to mute notifications and other system/app sounds).

  2. devbrisk commented on Nov 9, 2026

    @devbrisk
    Author
    • The resulting audio file is only 1–3 seconds long. It's not a longer file containing just 1–3 seconds of actual audio followed by silence or noise.
    • No I didn't subscribed to a stream, user can stop recording manually.
    • The user records a long voice message, but the resulting file saved on the server is only 1–3 seconds long.
    • A user reported that the app was in the foreground when this issue occurred.

    This is my start recording code:

    await _rec.start(
      const RecordConfig(
        encoder: AudioEncoder.aacLc,
        bitRate: 64000,
        sampleRate: 44100,
        numChannels: 1,
        autoGain: true,
        echoCancel: true,
        noiseSuppress: true,
      ),
      path: filePath,
    );
    

    and stop recording:
    final path = await _rec.stop();

    l will implement your suggestions in my app. This issue might be caused by not implementing your suggestions.

  3. devbrisk commented on Nov 13, 2026

    @devbrisk
    Author

    We conducted various tests and realized that these issues were caused by the way we had implemented the audio functionality.

    • Sometimes, when the user moved the app to the background, the voice playback would stop.
    • Sometimes, the user would play an audio file while recording a voice message, which caused the recording to stop. However, because we hadn't implemented onStateChanged, we weren't aware that the recording had been paused.
    • In some cases, the user would start recording a new voice message while a previous one was still being uploaded. Once the previous upload was completed, we played a one-second notification sound to indicate that the upload was successful. This sound caused the current recording to pause, but we weren't aware of it.
    • Unfortunately, we didn't have sufficient knowledge of audioInterruption and how it works, which led to these issues.

    We appreciate your guidance and support. Thank you

  4. llfbandit commented on Nov 13, 2026

    @llfbandit
    Owner

    Thanks for the feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions