PBJVision switch to front facing camera

431 views Asked by At

Hi I am trying to switch between the rear and front facing cameras if i start he session with the front facing camera it works but with the other way way round the AVCapturepreview layer is not visible and just presents a blank screen.

1

There are 1 answers

0
Mike242424 On BEST ANSWER

First stop the preview session. When stopped (use the delegate for this) set the camera device you want and restart the preview session. In code:

[[PBJVision sharedInstance] stopPreview];
//implement the following deluge ate
- (void)visionSessionDidStopPreview:(PBJVision *)vision{

vision.cameraDevice = PBJCameraDeviceFront;
[vision startPreview];
}