我在我的项目中使用了pod LLSimpleCamera。问题是,当我打电话开始视频录制时。它通过代码,但正好在下面(print isRecording)总是给出错误。
这是按钮操作
@IBAction func shutterButton(_ sender: Any) {
if videoMode == false {
self.camera.capture({(camera, capturedImage, metadata, error) -> Void in
if (error == nil) {
self.processImage(baseImage: capturedImage!)
}
else {
print("An error has occured: \(String(describing: error?.localizedDescription))")
}
}, exactSeenImage: true)
} else {
if(camera.isRecording == false) {
self.camera.startRecording(withOutputUrl: videoURL)
print(self.camera.isRecording)
} else {
self.camera.stopRecording({ (camera, outputUrl, error) in
print(self.camera.isRecording)
})
}
}
}
我的视频网址如下
let videoURL: URL = URL(fileURLWithPath: "recording")
答案 0 :(得分:0)
您的代码可能无法形成有效的fileURL
。
尝试更改此内容:
let videoURL: URL = URL(fileURLWithPath: "recording")
到此:
// Here we get a path to your app's temp directory to save your recording to.
let outputPathString = "\(NSTemporaryDirectory())recording.mov"
let videoURL = URL.init(fileURLWithPath: outputPathString)