Canardoux / flutter_sound

Flutter plugin for sound. Audio recorder and player.
Mozilla Public License 2.0
877 stars 573 forks source link

problem with audio codecs #991

Closed joselcv closed 4 months ago

joselcv commented 1 year ago

Flutter Sound Version :


Severity


Platforms you faced the error


Describe the bug When I try to record audio with: FlutterSoundRecorder recordAudio = FlutterSoundRecorder();

playFunction()async{ await recordAudio.openRecorder(); await recordAudio.startRecorder(toFile: '${folder.path}/myFile'); }

and do not specify the codec parameter, it returns an apparently empty .bin file, if I try to specify any of the codec (Codec.aacMP4, Codec.pcm8) etc. an error appears saying that these codecs are not compatible with the platform


Logs!!!!

lutter: ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: │ #0 FlutterSoundRecorder.openRecorder package:flutter_sound/public/flutter_sound_recorder.dart:372 flutter: │ #1 _ChatScreenState.build. package:prosafe/…/chat/chat_screen.dart:167 flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ flutter: │ 🐛 FS:---> openAudioSession flutter: └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: │ #0 FlutterSoundRecorder._openAudioSession package:flutter_sound/public/flutter_sound_recorder.dart:381 flutter: │ #1 FlutterSoundRecorder.openRecorder. package:flutter_sound/public/flutter_sound_recorder.dart:374 flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ flutter: │ 🐛 ---> openAudioSession flutter: └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: │ #0 FlutterSoundRecorder._openAudioSession package:flutter_sound/public/flutter_sound_recorder.dart:396 flutter: │ #1 FlutterSoundRecorder.openRecorder. package:flutter_sound/public/flutter_sound_recorder.dart:374 lutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ flutter: │ 🐛 Resetting flutter_sound Recorder Plugin flutter: └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: │ #0 FlutterSoundRecorder.openRecorderCompleted package:flutter_sound/public/flutter_sound_recorder.dart:171 flutter: │ #1 MethodChannelFlutterSoundRecorder.channelMethodCallHandler package:flutter_sound_platform_interface/method_channel_flutter_sound_recorder.dart:98 flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ flutter: │ 🐛 ---> openRecorderCompleted: true flutter: └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: │ #0 FlutterSoundRecorder.openRecorderCompleted package:flutter_sound/public/flutter_sound_recorder.dart:182 flutter: │ #1 MethodChannelFlutterSoundRecorder.channelMethodCallHandler package:flutter_sound_platform_interface/method_channel_flutter_sound_recorder.dart:98 flutter: 🐛 <--- openRecorderCompleted: true flutter: └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: │ #0 FlutterSoundRecorder._openAudioSession package:flutter_sound/public/flutter_sound_recorder.dart:412 flutter: │ #1 flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ flutter: │ 🐛 <--- openAudioSession flutter: └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: │ #0 FlutterSoundRecorder.openRecorder package:flutter_sound/public/flutter_sound_recorder.dart:376 flutter: │ #1 flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ lutter: │ 🐛 FS:<--- openAudioSession flutter: └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: │ #0 FlutterSoundRecorder.startRecorder package:flutter_sound/public/flutter_sound_recorder.dart:590 flutter: │ #1 _ChatScreenState.build. package:prosafe/…/chat/chat_screen.dart:168 flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ flutter: │ 🐛 FS:---> startRecorder flutter: └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: │ #0 FlutterSoundRecorder._startRecorder package:flutter_sound/public/flutter_sound_recorder.dart:614 flutter: │ #1 FlutterSoundRecorder.startRecorder. package:flutter_sound/public/flutter_sound_recorder.dart:592 flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ lutter: │ 🐛 FS:---> _startRecorder. flutter: └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: Instance of '_CodecNotSupportedException'

0 FlutterSoundRecorder._startRecorder

package:flutter_sound/public/flutter_sound_recorder.dart:643

#1 FlutterSoundRecorder.startRecorder. package:flutter_sound/public/flutter_sound_recorder.dart:592 #2 BasicLock.synchronized package:synchronized/src/basic_lock.dart:33 #3 FlutterSoundRecorder.startRecorder package:flutter_sound/public/flutter_sound_recorder.dart:591 -----------------------------------------------------------------
Larpoux commented 1 year ago

Valid codecs can be foud here

Do you run on Web Dart or native iOS?

joselcv commented 1 year ago

I'm running it on iOS, of the codecs it supports, none of them work bro 😕😰

radvansky-tomas commented 1 year ago

Same here, I am trying to run startPlayerFromStream and every combination of codecs crash the simulator. And in xcode it says that there is invalid format/number of channels.

UmairSaqibBhutta commented 10 months ago

same issue

renatolealdev commented 9 months ago

same issue

github-actions[bot] commented 8 months ago

This issue is stale because it has been open 365 days with no activity. Leave a comment or this will be closed in 7 days.

etekumoses commented 7 months ago

This issue is still coming up not sure why

RitchieP commented 7 months ago

Yes, the issue persists as of now. @joselcv do you have a workaround this?

Larpoux commented 7 months ago

@RitchieP , @joselcv

I think that there is a big problem with Play from Stream and Record to Stream on iOS. It used to work fine, but it doesn’t anymore in the last versions.

This is really bad because I think Sound with Streams is a very important feature. I spent several days fighting to debug this issue, but was not successful. I don’t have time to work further on Flutter Sound maintenance and someone one else should work on this issue.

I am very sorry for that.

RitchieP commented 7 months ago

Hmmm, guess the problem also exists in Android. I forgot to mention I faced a similar issue in Android

abdullhasseeb commented 4 months ago

Still same problem

Larpoux commented 4 months ago

Please, create a new issue explaining your problem, with logs, your platform, your Flutter Sound version, … Flutter Sound is supposed to work both on Android and iOS. This issue is old, and I can’t understand really your problem.

abdullhasseeb commented 4 months ago

Default codec is recording very low quality sound so I want to change codec but when I use codec like aacADTS, aacMP4 or any other , I got issue (Instance of '_CodecNotSupportedException')

But if I don't specify any codec then codec will be default and its working fine with default codec,

Larpoux commented 4 months ago

You can refer to this page to know the supported codecs by Flutter Sound

abdullhasseeb commented 4 months ago

Yes I have seen these supported codec, as mentioned in supported codec that aacADTS is working for all platforms but even i got same error, I had not tried only one I have tried all of codec but none of them working, just default is working fine