【发布时间】:2016-06-30 10:07:07
【问题描述】:
我使用 AVAudioRecorder 录制音频。我将 AVAudioSessionInterruptionNotification 添加到我的视图控制器以在中断期间暂停录制。
- (void)viewDidLoad
{
[super viewDidLoad];
// Other Stuffs
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(interrupted:)
name:AVAudioSessionInterruptionNotification
object:nil];
}
-(void)interrupted:(NSNotification *) sender
{
if(recorder.isRecording)
{
// Code To Update UI
[recorder pause];
}
}
问题1:在中断期间interruped方法被调用了两次。为什么?。在第一次通话期间,录音机为零。在第二次通话期间 recoder.isRecording 是 NO。为什么?
问题2:如果应用程序在收到中断后变为动作,[recorder record] 不会恢复录制到文件。而是开始将其记录为新的音频文件。如何解决?
【问题讨论】:
标签: ios objective-c avaudiorecorder