I am using AVCaptureVideoPreviewLayer
to pass the live video and apply openGL
shaders in realtime.
On using front camera, the video is mirrored, I want to un-mirror it before applying the shader.
Can anyone help there?
Added : code for switching to front camera :
-(void)showFrontCamera{
NSLog(@"inside showFrontCamera");
[captureSession removeInput:videoInput];
// Grab the front-facing camera
AVCaptureDevice *backFacingCamera = nil;
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
for (AVCaptureDevice *device in devices) {
if ([device position] == AVCaptureDevicePositionFront) {
backFacingCamera = device;
}
}
// Add the video input
NSError *error = nil;
videoInput = [[[AVCaptureDeviceInput alloc] initWithDevice:backFacingCamera error:&error] autorelease];
if ([captureSession canAddInput:videoInput]) {
[captureSession addInput:videoInput];
}
}