通过电话Avaudiorecorder中断后,继续录制音频



如何在通过打电话中断后继续录制音频?现在,在来电后,我的记录停止了,但是我想能够恢复录制

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()

to 暂停 recording,您已经检查了此

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

最新更新