Using AVCaptureDevice as SCNScene Background Content

During SceneKit: what a new presentation at WWCD2017 (44:19) it was indicated that we can now use AVCaptureDeviceas the background for SCNScene.

Fragment from the presentation:

let captureDevice: AVCaptureDevice = ...
scene.background.contents = captureDevice

However the following code

let captureDevice = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back)!
scene.background.contents = captureDevice

creates an error:

[SceneKit] Error: Cannot get pixel buffer (CVPixelBufferRef)

I also tried creating and starting AVCaptureSessionand then using the device, but it gives the same result.

What could be the problem here?

+1
source share
1 answer

Edit

This bug seems to be fixed in iOS 11.2


Original answer

this seems like a bug in SceneKit.

, ARSCNView. API SceneKit, .

+1

Source: https://habr.com/ru/post/1690340/


All Articles