flutter_sound icon indicating copy to clipboard operation
flutter_sound copied to clipboard

[BUG]: startRecorder crashes due to _CodecNotSupportedException even if isEncoderSupported returns true.

Open tsabata opened this issue 3 years ago • 2 comments

Flutter Sound Version 9.1.3:

  • FULL
|-- flutter_sound 9.1.3
|   |-- flutter_sound_platform_interface 9.1.3
|   |-- flutter_sound_web 9.1.3
|   |   |-- flutter_sound_platform_interface...


Severity

  • Crash

Platforms you faced the error

  • Android
  • Real device (Samsung s10e android 12)

Describe the bug

The startRecorder method crashes due to codec even though isEncoderSupported returns true.

To Reproduce

    bool encoderSupported = await _recorder.isEncoderSupported(Codec.aacMP4);
    developer.log('EncoderSupported: ${encoderSupported.toString()}');
    await _recorder.startRecorder(
      toFile: _audioPath,
      codec: Codec.aacMP4,
    );

This leads to:

[log] EncoderSupported: true
E/flutter (25315): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Instance of '_CodecNotSupportedException'
E/flutter (25315): #0      FlutterSoundRecorder._startRecorder (package:flutter_sound/public/flutter_sound_recorder.dart:643:9)
E/flutter (25315): <asynchronous suspension>
E/flutter (25315): #1      FlutterSoundRecorder.startRecorder.<anonymous closure> (package:flutter_sound/public/flutter_sound_recorder.dart:592:7)
E/flutter (25315): <asynchronous suspension>
E/flutter (25315): #2      BasicLock.synchronized (package:synchronized/src/basic_lock.dart:33:16)
E/flutter (25315): <asynchronous suspension>
E/flutter (25315): #3      FlutterSoundRecorder.startRecorder (package:flutter_sound/public/flutter_sound_recorder.dart:591:5)
E/flutter (25315): <asynchronous suspension>
E/flutter (25315): #4      _AudioAnswerState.startRecording (package:treasure_hunt/widget/answer/audio.dart:80:5)
E/flutter (25315): <asynchronous suspension>

Logs

See logs (pastebin)


tsabata avatar Feb 27 '22 16:02 tsabata

Have same error... Any update? @tsabata what you do for solve this problem?

enzodanjour avatar Apr 07 '22 11:04 enzodanjour

@tsabata,

It seems that the file extension of your record is not consistent with your codec (aac/mp4)

Larpoux avatar Apr 07 '22 15:04 Larpoux

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.

github-actions[bot] avatar Dec 05 '23 01:12 github-actions[bot]