gpt4 book ai didi

swift - 电话中断后继续录制音频,AVAudioRecorder

转载 作者:行者123 更新时间:2023-11-28 07:27:03 36 4
gpt4 key购买 nike

如何在被来电打断后继续录音?现在来电后我的录音停止了,但我希望能够继续录音

func audioRecorderDidFinishRecording(_ recorder: AVAudioRecorder,
successfully flag: Bool) {

if flag {
recorder.stop()
isRecording = false
recordButton.setImage(#imageLiteral(resourceName: "RecButtonRecord"), for: .normal)
playButton.isEnabled = true
playButton.alpha = 1
titleRecordTextView.isHidden = false
sourceRecordTextView.isHidden = false

}
else {

}

}

最佳答案

使用

recorder.pause()

暂停记录,你必须检查这个

AppDelegate 方法管理

 func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}

,您必须使用 NotificationCenter 从此处恢复

关于swift - 电话中断后继续录制音频,AVAudioRecorder,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56303930/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com