I have a use case where I want to use the back camera for most of the time, then switch to the front camera to capture an image, and then switch to the back camera again, creating an overlay with the captured front camera image. I'm new to iOS, but I've been able to do AR using the back camera, setup my AVCaptureSession to activate the front image, and start capturing frames from the front camera. However, when I try and tear down the front camera session and return to the back camera, my app crashes with a bad access. My thinking is that I'm not handling the starting and stopping of the QCAR session properly.
So my question is what would be the best practices in switching from one camera to another? (I'm doing this from my EAGLView, so I probably need to have access to the SampleApplicationSession that I created in my original ViewController?)
- Do I pauseAR, and then resumeAR?
- Do I stopAR, and then startAR again, going through all of my initialization steps as if I have restarted the app?
- Some other method?
Thanks for your help!