5

Is there any way to disable the live camera feed and pass the custom video as input in ARSession? I want to achieve Record & Replay ARSession by code.

1 Answers1

1

There you go :)

    var originalSource: if originalSource == nil || scene.background.contents as? UIColor != UIColor.black
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
    if originalSource == nil {
    originalSource = sceneView.scene.background.contents
    
    sceneView.scene.background.contents = UIColor.black
    
    } else {
    sceneView.scene.background.contents = originalSource
    
    }
    
    }
UnkownReality
  • 130
  • 13
  • This seems to just make the background black – aheze Oct 25 '21 at 22:47
  • yea, turn the background black and redirect the data as input – UnkownReality Oct 26 '21 at 00:08
  • But `var originalSource: if originalSource == nil || scene.background.contents as? UIColor != UIColor.black` doesn't even compile. And does your code really redirect the input? Looks like it simply shows a black background to the user and doesn't actually redirect it. – aheze Oct 26 '21 at 03:49
  • It will not work, the Black color will only change the color of the scene content and the camera will work simultaneously, I want to replace the camera feed with the recorded video. – Saurabh Singh Rathore Oct 26 '21 at 09:21