audio_waveforms icon indicating copy to clipboard operation
audio_waveforms copied to clipboard

Recording on iOS simulator not working

Open codeswot opened this issue 3 months ago • 4 comments

Describe the bug Recording does not work on ios simulator, the recording starts but the waveform or sign of audio being picked up is not showing and when I stop the recording and inspect the file path I do see the recorded audio but always with 28 bytes and the file does not play.

To Reproduce Steps to reproduce the behavior:

//1
  final RecorderController recorderController =
      RecorderController()
        ..androidEncoder = AndroidEncoder.aac
        ..androidOutputFormat = AndroidOutputFormat.mpeg4
        ..iosEncoder = IosEncoder.kAudioFormatMPEG4AAC;
//2
    await recorderController.record();
//3
    final path = await recorderController.stop();

NOTE: the path is to the apps document directory which I can navigate via my macbook Expected behavior I expect the audio to be recorded and saved to the path

Smartphone (please complete the following information):

  • Device: iPhone 15 Pro Max (Simulator)
  • OS: 17.2
  • Version [e.g. 22]

codeswot avatar Mar 12 '24 17:03 codeswot

@codeswot Can you please try on real device also check if you can record after providing path in record function.

ujas-m-simformsolutions avatar Mar 14 '24 14:03 ujas-m-simformsolutions

I can confirm same issue on a real device, and when path is provided to the record function. https://github.com/SimformSolutionsPvtLtd/audio_waveforms/issues/288

jt274 avatar Apr 19 '24 15:04 jt274

@codeswot The issue might have to be the extension you have set. Please make sure that the file extension you're using is supported by the encoder you're using and the underlying platform.

Ujas-Majithiya avatar Apr 20 '24 12:04 Ujas-Majithiya

I have exactly the same problem. This used to work just fine:

_recorderController = RecorderController()
      ..androidEncoder = AndroidEncoder.aac
      ..androidOutputFormat = AndroidOutputFormat.mpeg4
      ..iosEncoder = IosEncoder.kAudioFormatMPEG4AAC
      ..sampleRate = 44100;

And trying to record into

_recordFilePath = await getApplicationDocumentsDirectory().then((value) => '${value.path}/recording.m4a');
await _recorderController.record(path: _recordFilePath);

So the file extension shouldn't be the problem. Any advice?

sarintom avatar Apr 29 '24 12:04 sarintom