AvAudioRecorder stops/restart after recording just started

733 views Asked by At

In an iOS 10.2 app, an AVAudioRecorder is set up to record, and display level metering:

recorder = [[ AVAudioRecorder alloc] initWithURL:url settings:recordSetting error:&error];
[recorder setDelegate:self];
[recorder prepareToRecord];
[recorder record];

When I start the recorder, I noticed that the vu-meter is not updated. I noticed that the audioRecorderDidFinishRecording: successfully: method is called immediately after the recording has started. But the AVAudioRecorder still records after that. And the audio file can be saved and played.

More strangely, when I pause the recording and resume it, the audioRecorderDidFinishRecording: successfully: is not fired as in the first case, and the recording resume with vu-meter updating.

Any idea of this strange behavior?

1

There are 1 answers

2
Aman Gangurde On BEST ANSWER

when you are setting the AVPlayer, you have to keep in mind that only one instance can be done , either you can play the recorded audio or can run the recorder. so accordingly you have to manage the delegates and the AVPlayer configuration settings.

hope it works.