recorder works on iPhone 3GS but not on iPhone 3G

2019-04-13 14:52发布

I have a AVAudioRecorder, which gets initialized like:

_recorder = [AVAudioRecorder alloc];
NSMutableDictionary *recordSettings = [[[NSMutableDictionary alloc] initWithCapacity:2] autorelease];
[recordSettings setObject:[NSNumber numberWithInt:kAudioFormatMPEG4AAC] forKey: AVFormatIDKey];
[recordSettings setObject:[NSNumber numberWithInt:AVAudioQualityLow] forKey: AVEncoderAudioQualityKey]; 
NSURL *url = [NSURL fileURLWithPath:[self getActualSoundPath]];
[_recorder initWithURL:url settings:recordSettings  error:nil];    
[_recorder setDelegate:self];

This code works perfectly in my Simulator and on my iPhone 3GS but not on the older iPhone 3G...

What is the problem on that?

Thanks Markus

1条回答
\"骚年 ilove
2楼-- · 2019-04-13 15:28

The iPhone 3G doesnt have support for hardware AAC encoding like the 3GS/4/4S. You could use linear PCM, but thats not compressed.

See this thread for supported formats: How can I record AMR audio format on the iPhone?

Apple lossless (kAudioFormatAppleLossless) and iLBC (kAudioFormatiLBC) seems to work fine on the iPhone 3G.

kAudioFormatAppleIMA4 is recommended to use, but its not recognized by mobile Safari.

/Marcus

查看更多
登录 后发表回答