我创造了一个自定义的相机,到目前为止,它运行得非常完美。我可以录制一个视频,停止记录没有错误或错误。我想添加到这台相机的一个功能是暂停录制的能力。
在网上进行了大量研究之后,我发现解决方案是在单击“暂停”按钮时实际停止录制,并在单击“简历”按钮时开始另一次录制。在那之后,你应该把视频合并在一起。
我不知道如何合并视频,我在网上查了很多东西,一直无法找到解决方案。
谢谢!
这是我的录音按钮函数
@IBAction func recordVideoButtonPressed(sender:AnyObject) {
if self.movieFileOutput.isRecording {
isRecording = false
self.movieFileOutput.stopRecording()
} else {
isRecording = true
self.movieFileOutput.connection(withMediaType: AVMediaTypeVideo).videoOrientation = self.videoOrientation()
self.movieFileOutput.maxRecordedDuration = self.maxRecordedDuration()
self.movieFileOutput.startRecording(toOutputFileURL: URL(fileURLWithPath: self.videoFileLocation()), recordingDelegate: self)
}
self.updateRecordButtonTitle()
}
这是我的暂停按钮函数
func pauseVideo() {
if isRecording {
if isPaused == false {
isPaused = true
recordButton.isEnabled = false
recordButton.backgroundColor = UIColor.wetAsphalt
recordButton.setTitle("Paused", for: .normal)
} else {
isPaused = false
recordButton.isEnabled = true
recordButton.backgroundColor = UIColor.red
updateRecordButtonTitle()
}
} else {
return
}
}
https://stackoverflow.com/questions/44895563
复制相似问题