question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG]: stopRecorder returning empty Url of recorded audio on iOS, working fine on android.

See original GitHub issue

Flutter Sound Version :

Full

flutter pub deps | grep flutter_sound |-- flutter_sound_lite 8.1.1 | |-- flutter_sound_platform_interface 8.1.1 | |-- flutter_sound_web 8.1.1 | | |-- flutter_sound_platform_interface…


Severity

  • Result is not what expected ? Expected url path however getting empty string

Platforms you faced the error

  • iOS Yes

  • Emulator Yes


Describe the bug stopRecorder returning empty Url of recorded audio on iOS, working fine on android.

To Reproduce

Future record() async {
    final isGranted = await Permission.microphone.request();
    if(isGranted.isGranted){
      await _flutterSoundRecorder.openAudioSession();
      await _flutterSoundRecorder.startRecorder(toFile: "${DateTime.now().toString()}.mp3");
    }else{
      print("Permission not granted");
    }
}
  Future<String> stopRecording()async{
    final url = await _flutterSoundRecorder.stopRecorder();
    await _flutterSoundRecorder.closeAudioSession();


    print(url);
    return url //url = "" in ios;
  }

calling stopRecording returning empty string only in ios.


Logs!!!

flutter: FS:---> openAudioSession
flutter: ---> openAudioSession
flutter: Resetting flutter_sound Recorder Plugin
@resetPlugin
iOS: ---> resetPlugin
iOS: <--- resetPlugin
@openRecorder
IOS:--> setAudioFocus
IOS:<-- setAudioFocus
flutter: <--- openAudioSession
flutter: ---> openRecorderCompleted: true
flutter: <--- openRecorderCompleted: true
flutter: FS:<--- openAudioSession
flutter: FS:---> startRecorder
flutter: FS:---> _startRecorder.
flutter: Calling instance.startRecorder
flutter: ---> startRecorderCompleted: true
flutter: <--- startRecorderCompleted: true
flutter: FS:<--- _startRecorder.
flutter: FS:<--- startRecorder
flutter: recording start
flutter: FS:---> stopRecorder
flutter: FS:---> stopRecorder
flutter: FS:---> stop
iOS ---> stopRecorder
iOS <--- stopRecorder
flutter: ---> stopRecorderCompleted: true
flutter: <---- stopRecorderCompleted: true
flutter: FS:<--- stop
flutter: FS:<--- stopRecorder :
flutter: FS:<--- stopRecorder
flutter: FS:---> closeAudioSession
flutter: FS:---> closeAudioSession
flutter: FS:---> stop
iOS ---> stopRecorder
iOS <--- stopRecorder
flutter: ---> stopRecorderCompleted: true
flutter: <---- stopRecorderCompleted: true
flutter: FS:<--- stop
iOS ---> closeRecorder
iOS: ---> releaseSession
iOS: <--- releaseSession
iOS <--- closeRecorder
flutter: ---> closeRecorderCompleted
flutter: <--- closeRecorderCompleted
flutter: FS:<--- closeAudioSession
flutter: FS:<--- closeAudioSession
flutter: [URL expected but empty]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14

github_iconTop GitHub Comments

1reaction
Larpouxcommented, Jul 15, 2021

Yes @mhstoller , You are right : probably better if Flutter Sound throws an understable exception when the user tries to record something which has a mp3 extension.

Mp3 cannot be recorded, neither on iOS nor Android. MP3 is (was?) not a free codec, and we must have a Thomson license to record mp3. One of my many project is to allow recoding MP3, using the “lame” library. (Actually Flutter Sound is linked with Mobile FFmpeg, and Mobile FFmpeg includes the “lame” library).

I told @themaaz32 that he/she is wrong trying to record Mp3, but I think that it is not really the problem. Actually Flutter Sound does not use the file extension to select the Codec. It uses a codec: parameter and this parameter has a default value AAC. Another solution is to have the Codec parameter mandatory and not optional. I would prefer this solution but this would be a breaking change

But I really agree with you : if the extension is incorrect, probably the developer is trying to do something wrong and we must display at least a Warning. Actually I am busy on implemented a smart “Logger” : the Developer will be able to choose if he/she wants to have the full debugging logs, or just Errors and Warnings. Please keep this issue open : someone should do something for those kinds of problems.

BTW : @mhstoller : you are great 👍 . You spent time yesterday on another Problem Report, and you tried to execute the @AbdallahLabib’s Code. I really appreciate that you spend time on Flutter Sound maintenance. There is not enough developers involved in the Flutter Sound maintenance and development.

0reactions
Larpouxcommented, Jul 27, 2021

@mhstoller ,

Your Pull Request is implemented in v.8.2.6. I will release this version in a few days. Thank you again for your contribution. I really appreciate that you help me doing Flutter Sound Customer(?) Support.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Audio record ios 11 no data · Issue #324 - GitHub
I have adapted my code to use StereoAudioRecorder. I get no error in the console but just that I record nothing (the data...
Read more >
stopRecorder() is not working - react-native-audio-recorder ...
Audio recording starts successfully but keep recording even after calling stopRecorder(). Tried number of solutions from gitHub but nothing ...
Read more >
dooboolab - Bountysource
A clue how to achieve it is that i read in this issue that Android API as a ... [BUG]: stopRecorder returning empty...
Read more >
Audio - Expo Documentation
Audio. expo-av allows you to implement audio playback and recording in your app. Note that audio automatically stops if headphones / bluetooth audio...
Read more >
Creating a Flutter audio player and recorder app
Before continuing with the tutorial, ensure you have the following: Flutter installed; Android Studio or Xcode installed. Creating and setting ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found