录像机适用于iPhone 3GS但不适用于iPhone 3G

Mar*_*kus 2 iphone avaudiorecorder iphone-3gs 3g

我有一个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];
Run Code Online (Sandbox Code Playgroud)

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

有什么问题?

谢谢马库斯

Mar*_*cus 6

iPhone 3G不支持像3GS/4/4S这样的硬件AAC编码.你可以使用线性PCM,但那不是压缩的.

有关支持的格式,请参阅此主题:如何在iPhone上录制AMR音频格式?

Apple无损(kAudioFormatAppleLossless)和iLBC(kAudioFormatiLBC)似乎在iPhone 3G上运行良好.

建议使用kAudioFormatAppleIMA4,但移动Safari无法识别.

/马库斯