An app I am working on records audio and began to fail to record on iPad4 after updating from iOS8 to iOS9.
The recorder settings used so far are:
audioSegmentURL = ... (a URL with fileextension @"mp4");
recorderSettings = @{ AVFormatIDKey: @(kAudioFormatMPEG4AAC),
AVEncoderAudioQualityKey: @(AVAudioQualityMin),
AVEncoderBitRateKey: @(8),
AVNumberOfChannelsKey: @(1),
AVSampleRateKey: @(11025.0)
};
This is the initialization of the AVAudioRecorder
:
NSError *err;
AVAudioRecorder *audioRecorder = [[AVAudioRecorder alloc] initWithURL:audioSegmentURL settings:recorderSettings error:&err];
This call seems to succeed, err
is nil
.
The call to prepareToRecord
returns NO
:
BOOL res = [audioRecorder prepareToRecord];
Unfortunately I do not have an iPad4. The problem does not occur on an iPad Mini2. (I also have an iPad Air, but that does not support the AAC hardware encoding and it uses different recording settings.)
This worked on iOS8. It started to fail after an upgrade of the iPad4 to iOS9.
Does someone know, which settings do work on an iPad4 with iOS9?
Thanks a lot.
EDIT1:
For a test I let the audio recording use this on the iPad4:
audioSegmentURL = ... (a URL with fileextension @"caf");
recorderSettings = @{ AVFormatIDKey: @(kAudioFormatAppleIMA4),
AVNumberOfChannelsKey: @(1),
AVSampleRateKey: @(16000.0)
};
The recording seemed to work. However, after the recording I am appending several sound snippets together and that seemed to fail on the iPad4.
The composition uses AVMutableComposition
which has multiple AVMutableCompositionTrack
s, an AVAssetExportSession
and the output filetype is set to AVFileTypeAppleM4A
.
Is M4A
incompatible with IMA4
on iPad4 with iOS9?
Your bitrate looks incorrect in first recording settings dictionary. Try removing the AVEncoderBitRate key. I don't know if it matters, but you may want a filename ending in m4a rather than mp4 for a file of just audio.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.