0

How to switch mode video converter photo In PBJVision

now

PBJVision *vision = [PBJVision sharedInstance];
vision.delegate = self;

[vision setCameraMode:PBJCameraModePhoto];
[vision setCameraOrientation:PBJCameraOrientationPortrait];
[vision setFocusMode:PBJFocusModeAutoFocus];
[vision setOutputFormat:PBJOutputFormatPreset];

[[PBJVision sharedInstance] capturePhoto];
shen
  • 1
  • 3

1 Answers1

0

You can change camera mode as adding just one line. The answer is already exist in your code. That is.

[vision setCameraMode:PBJCameraModeVideo];

And use this to recording video.

[[PBJVision sharedInstance] startVideoCapture];
[[PBJVision sharedInstance] endVideoCapture];

It might be better if you know additionally these.

Changing camera mode to another seems like need a bit time.

When I had used like this, error occurred. (In my case, change to photo mode from video mode)

[vision setCameraMode:PBJCameraModePhoto];
[vision capturePhoto];

The cause is that session setting for camera mode changing is not end completely yet.

- (void)capturePhoto
{
    if (![self _canSessionCaptureWithOutput:_currentOutput] || _cameraMode != PBJCameraModePhoto) {
    DLog(@"session is not setup properly for capture");
    return; <--- I'm returned;
    }
    ....
}

So be careful to write sequentially changing camera mode and calling capture. :)

Ellie
  • 1