piemonte/PBJVision — pull request #206 by riosc (2014-10-30 19:20:34+00:00)
Title: changing session presset at runtime

Hey, I had an issue setting up PBJVision in the example project. My basic configuration of PBJVision singleton class was the following inside of _resetCapture method:

vision.cameraMode = PBJCameraModeVideo;
vision.cameraOrientation = PBJCameraOrientationLandscapeLeft;
vision.focusMode = PBJFocusModeContinuousAutoFocus;
vision.captureSessionPreset = AVCaptureSessionPreset1920x1080;
vision.videoRenderingEnabled = YES;
vision.additionalCompressionProperties = @{AVVideoProfileLevelKey : AVVideoProfileLevelH264Baseline41}; // AVVideoProfileLevelKey requires specific captureSessionPreset

So when I try to flip the camera, the preview layer stop working:

- (void)_handleFlipButton:(UIButton *)button
{
PBJVision *vision = [PBJVision sharedInstance];
vision.additionalCompressionProperties = @{AVVideoProfileLevelKey : AVVideoProfileLevelH264Baseline30}; // AVVideoProfileLevelKey requires specific captureSessionPreset
vision.captureSessionPreset = AVCaptureSessionPresetMedium;
vision.cameraDevice = vision.cameraDevice == PBJCameraDeviceBack ? PBJCameraDeviceFront : PBJCameraDeviceBack;
}

So, to fix this issue I had to update the value of sessionPreset property of _captureSession object.