title: Changing ARSCNView background
body: <p>iOS 13.1.3 on iPad Pro</p>
  
  <p>Seem like there is a a same problem on previous iOS versions.
  <a href="https://stackoverflow.com/questions/46173225/using-avcapturedevice-as-scnscene-background-content">Using AVCaptureDevice as SCNScene background content</a></p>
  
  <p>My app uses front cam to create AR face in iOS. At first tour, my app uses default SCNView with camera input. After first tour, I am setting ARSCNView background to a UIImage. After setting this I can't go back to previous state by setting <code>scnview.scene.background</code> to <code>nil</code> or <code>inputdevice</code>. </p>
  
  <p>How can I take it back to previous state that shows camera input?
  First, I set like below which is shown successfully.</p>
  
  <pre><code>sceneView.scene.background.contents = UIImage(named: "bruin.jpeg")
  </code></pre>
  
  <p>Then after 15 seconds, I set it with the code below but I get stable image not video preview layer.</p>
  
  <pre><code>DispatchQueue.main.async {
      let captureDevice = AVCaptureDevice.default(.builtInWideAngleCamera, 
                                             for: .video, 
                                        position: .front)!
      self.sceneView.scene.background.contents = captureDevice
  }
  </code></pre>
  
  <p>I get this error in output:</p>
  
  <pre><code>// SceneKit Error: Could not get pixel buffer (CVPixelBufferRef)
  </code></pre>