Reputation: 314
Is it as easy as:
-(IBAction)switchCameraTapped: (id)sender{
if (AVCaptureDevicePosition == 1) {
AVCaptureDevicePosition == 2;
} else if (AVCaptureDevicePosition ==2){
AVCaptureDevicePosition == 1;}
}
?
Do I have to create a new capture session or remove any existing inputs?
Upvotes: 0
Views: 160
Reputation: 36169
No, it's not that simple - the position is a read-only property on AVCaptureDevice
:
@property(nonatomic, readonly) AVCaptureDevicePosition position;
You don't need to destroy the capture session, you can instead call
[session stopRunning];
and reconfigure the inputs with removeInput
and addInput
.
Don't forget to call startRunning
when you've finished.
Upvotes: 1