【发布时间】:2011-08-17 08:54:07
【问题描述】:
当我从 iphone 录制音频时,如下所示:
//Setup the dictionary object with all the recording settings that this
//Recording sessoin will use
NSMutableDictionary* recordSetting = [[NSMutableDictionary alloc] init];
[recordSetting setValue :[NSNumber numberWithInt:kAudioFormatAppleIMA4] forKey:AVFormatIDKey];
[recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey];
[recordSetting setValue:[NSNumber numberWithInt: 2] forKey:AVNumberOfChannelsKey];
//Now that we have our settings we are going to instanciate an instance of our recorder instance.
//Generate a temp file for use by the recording.
NSDate *now = [NSDate dateWithTimeIntervalSinceNow:0];
NSString *caldate = [now description];
recordedTmpFile = [[NSString stringWithFormat:@"%@/%@.caf", DOCUMENTS_FOLDER, caldate] retain];
NSLog(@"Using File called: %@",recordedTmpFile);
url = [NSURL fileURLWithPath:recordedTmpFile];
error = nil;
//Setup the recorder to use this file and record to it.
recorder = [[ AVAudioRecorder alloc] initWithURL:url settings:recordSetting error:&error];
但我的问题是应用程序,我正在开发的应用程序也是为 Android 开发的,但使用 iPhone 和 android 的通用服务器。当我将录制的音频从 iPhone 发布到服务器并尝试在 Android 中播放该音频时,它显示警报为不支持的文件。
对于我应该录制哪种格式以在 iPhone 和 Android 中播放音频有什么帮助吗?
任何人的帮助将不胜感激。
【问题讨论】:
标签: iphone android objective-c ios audio-recording