Ios 从服务器流式传输.caf音频文件
我正在做一个项目,我正在录制语音并将其上传到服务器。上传的文件格式为.caf(核心音频格式) 现在,当我尝试使用Ios 从服务器流式传输.caf音频文件,ios,objective-c,audio,audio-recording,avplayer,Ios,Objective C,Audio,Audio Recording,Avplayer,我正在做一个项目,我正在录制语音并将其上传到服务器。上传的文件格式为.caf(核心音频格式) 现在,当我尝试使用AVPLayer从服务器播放此文件时,它会在下面给出错误消息 Error Domain=AVFoundationErrorDomain code=-11819“无法完成操作”UserInfo=0x2f31e0{nsLocalizedRecoverysSuggestion=稍后再试,NSLocalizedDescription=无法完成操作} 我已经检查了服务器上的文件,它没有损坏 我的
AVPLayer
从服务器播放此文件时,它会在下面给出错误消息
Error Domain=AVFoundationErrorDomain code=-11819“无法完成操作”UserInfo=0x2f31e0{nsLocalizedRecoverysSuggestion=稍后再试,NSLocalizedDescription=无法完成操作}
我已经检查了服务器上的文件,它没有损坏
我的问题是:.caf文件支持流媒体吗?如果不是,那么我需要以哪种格式转换支持流媒体的录制文件?在
AVAudioSession
使用.mp4在两侧播放音频:
AVAudioSession * audioSession = [AVAudioSession sharedInstance];
[audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error: &error];
[audioSession setActive:YES error: &error];
NSMutableDictionary* recordSetting = [[NSMutableDictionary alloc] init];
[recordSetting setValue :[NSNumber numberWithInt:kAudioFormatMPEG4AAC] forKey:AVFormatIDKey];
[recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey];
[recordSetting setValue:[NSNumber numberWithInt: 2] forKey:AVNumberOfChannelsKey];
NSURL *recordedTmpFile = [NSURL fileURLWithPath:yourdirectorypath];
//file=[NSString stringWithFormat:@"%@",recordedTmpFile];
NSLog(@" filr url%@",recordedTmpFile);
// NSLog(@" filr url%@",file);
recorder = [[ AVAudioRecorder alloc] initWithURL:recordedTmpFile settings:recordSetting error:&error];
[recorder setDelegate:self];
[recorder prepareToRecord];
[recorder record];
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];