录音机适用于 iPhone 3GS,但不适用于 iPhone 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];
这段代码在我的模拟器和 iPhone 3GS 上完美运行,但在较旧的 iPhone 3G 上不起作用......
这有什么问题?
谢谢 马库斯
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
iPhone 3G 不支持 3GS/4/4S 等硬件 AAC 编码。您可以使用线性 PCM,但那不是压缩的。
请参阅此帖子了解支持的格式:如何录制 AMR iPhone 上的音频格式?
Apple 无损 (kAudioFormatAppleLossless) 和 iLBC (kAudioFormatiLBC) 似乎在 iPhone 3G 上运行良好。
推荐使用kAudioFormatAppleIMA4,但移动端Safari无法识别。
/马库斯
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