2

我有一个 AVAudioRecorder,它的初始化如下:

_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];

这段代码在我的模拟器和我的 iPhone 3GS 上完美运行,但在旧款 iPhone 3G 上却不行......

这有什么问题?

谢谢马库斯

4

1 回答 1

6

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

于 2010-09-14T12:11:19.767 回答