首页 > 编程知识 正文

iphone录音中断,苹果录制中断

时间:2023-05-04 03:00:28 阅读:275326 作者:4979

iOS录音过程中,有时候会有录音中断问题,本来录50秒,很可能后面10秒就录不上,一般都是程序逻辑出现问题;录制语音前需要对录音设备属性Category设置如下:

[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryRecord error:nil];
或[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];



由于程序逻辑可能出现问题,在录音过程中重新设置Category属性,比如设置如下:

[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];

这个设置会取消设备录音功能,从而导致录音中断

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。