使用AVCaptureDevice作为SCNS场景背景内容 [英] Using AVCaptureDevice as SCNScene background content
问题描述
在AVCaptureDevice
作为SCNScene
的背景内容.
During the SceneKit: What's New presentation at WWCD2017 (44:19) it was stated that we can now use AVCaptureDevice
as background content for SCNScene
.
演示文稿中的摘录:
let captureDevice: AVCaptureDevice = ...
scene.background.contents = captureDevice
但是以下代码
let captureDevice = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back)!
scene.background.contents = captureDevice
产生错误:
[SceneKit] Error: Cannot get pixel buffer (CVPixelBufferRef)
我还尝试创建并启动AVCaptureSession
,然后使用该设备,但结果相同.
I also tried to create and start AVCaptureSession
and then use the device, but it gives the same result.
这里可能是个问题?
推荐答案
编辑
此错误似乎已在iOS 11.2中修复
This bug seems to be fixed in iOS 11.2
原始答案
这似乎是SceneKit中的错误.
this appears to be a bug in SceneKit.
如果这对您有用,则一种解决方法是使用ARSCNView
.它使您可以访问所有SceneKit API,并自动将视频供稿绘制为场景的背景.
If that works for you a workaround would be to use an ARSCNView
. It gives you access to all the SceneKit APIs, and it automatically draws the video feed as the scene's background.
这篇关于使用AVCaptureDevice作为SCNS场景背景内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!