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

瘦欲@ 提交于 2019-12-09 19:33:17

问题


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:


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



来源:https://stackoverflow.com/questions/3509921/recorder-works-on-iphone-3gs-but-not-on-iphone-3g

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!