오디오 녹음을 시도하고 동시에 재생하려고합니다. 여기에 코드가 있습니다. 나중에 녹화 및 재생 만 가능합니다. 스피커를 통해 동시에 재생하고 싶습니다. 도움이 필요해. 나는 올바른 클래스를 사용하고 있는지 확신하지 못한다.녹음하고 동시에 오디오를 재생하십시오.
AVAudioSession * audioSession = [AVAudioSession sharedInstance];
[audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
[audioSession setActive:YES error:nil];
temporaryRecFile = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithString:@"VoiceFile"]]];
recorder = [[AVAudioRecorder alloc] initWithURL:temporaryRecFile settings:nil error:nil];
[recorder setDelegate:self];
[recorder prepareToRecord];
[recorder record];
AVAudioPlayer * player = [[AVAudioPlayer alloc] initWithContentsOfURL:temporaryRecFile error:nil];
player.volume = 1;
[player play];
해결 했습니까? –