AVFAudio - 在 AVAudioRecorder.stop() 之后立即执行文件复制是否安全
AVFAudio - Is it safe to perform file copy immediately after AVAudioRecorder.stop()
我们通过
开始录音
self.avAudioRecorder = try AVAudioRecorder(
url: self.recordingFileUrl,
settings: settings
)
self.avAudioRecorder.record()
在某些时候,我们会通过
停止录制
self.avAudioRecorder.stop()
我想知道,在 self.avAudioRecorder.stop()
之后立即对 self.recordingFileUrl
执行文件复制是否安全?
是否所有记录数据都已刷新到self.recordingFileUrl
并且self.recordingFileUrl
文件已正确关闭?
在audioRecorderDidFinishRecording(_:successfully:)
中执行文件保存似乎更安全
来源:https://developer.apple.com/forums/thread/705561
It does seem to be synchronous, though in theory something
could still fail at that point, so it is safer to use the delegate
method audioRecorderDidFinishRecording(_:successfully:), rather than
make an assumption that the recording will always succeed after
calling stop.
我们通过
开始录音self.avAudioRecorder = try AVAudioRecorder(
url: self.recordingFileUrl,
settings: settings
)
self.avAudioRecorder.record()
在某些时候,我们会通过
停止录制self.avAudioRecorder.stop()
我想知道,在 self.avAudioRecorder.stop()
之后立即对 self.recordingFileUrl
执行文件复制是否安全?
是否所有记录数据都已刷新到self.recordingFileUrl
并且self.recordingFileUrl
文件已正确关闭?
在audioRecorderDidFinishRecording(_:successfully:)
来源:https://developer.apple.com/forums/thread/705561
It does seem to be synchronous, though in theory something could still fail at that point, so it is safer to use the delegate method audioRecorderDidFinishRecording(_:successfully:), rather than make an assumption that the recording will always succeed after calling stop.