ios - 如何使用 ARKit 和 SceneKit 录制屏幕?
问题描述
我想使用 ARKit 和 SceneKit 录制视频,但我可以保存来自 ARKit 的素材,但无法保存来自 SceneKit 的素材。我开始录制的代码如下:
@IBAction func startRecording(sender: UIButton) {
sender.backgroundColor = .red
do {
_ = try sceneView.startVideoRecording()
guard let recorder = sceneView.recorder else { return }
let captureSession = session
guard let audioDevice = AVCaptureDevice.default(for: .audio) else { return }
do {
let captureInput = try AVCaptureDeviceInput(device: audioDevice)
guard captureSession.canAddInput(captureInput) else { return }
captureSession.addInput(captureInput)
} catch {
print("Can't create AVCaptureDeviceInput: \(error)")
}
guard captureSession.canAddRecorder(recorder) else { return }
captureSession.addRecorder(recorder)
captureSession.startRunning()
self.captureSession = captureSession
} catch {
print("Something went wrong during video-recording preparation: \(error)")
}
}
我结束录制的代码如下:
@IBAction func stopRecording(sender: UIButton) {
sender.backgroundColor = .white
sceneView.finishVideoRecording { (recording) in
print("Recoring Finished", recording.url)
self.checkAuthorizationAndPresentActivityController(toShare: recording.url, using: self)
}
}
由于我的代码运行而创建的视频链接是:屏幕录制
我无法从相机录制视频。如何解决我的录音问题?
解决方案
推荐阅读
- reactjs - React Dropdown 动态按钮与材质 UI
- java - 将 JSON 字符串或 JSON 数组映射到 Java 对象中的字符串
- terraform - 如何使用 terraform aws-lambda 模块引用本地打包的源文件
- python - 为什么这个列表理解比 for 循环慢得多?
- python - leave 类型的对象不是 JSON 可序列化的
- r - 为什么我无法将我的数据集附加到 R studio?这以前没有发生过
- python - "in" 运算符链接( True in [True] in [True] OUTPUT: False )
- python-3.x - 修复或删除熊猫中带有额外列的行
- python - 我们需要使用什么格式将数据存储在 db.Time 中?
- scala - 在scalaj中解析HttpResponse主体