Vote count:
0
I am making custom camera to take pictures. I have been able to set custom camera which looks as below using following code.
-(void)viewWillAppear:(BOOL)animated{
session = [[AVCaptureSession alloc] init];
[session setSessionPreset:AVCaptureSessionPresetPhoto];
AVCaptureDevice *inputDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
NSError *error;
AVCaptureDeviceInput *deviceInput = [AVCaptureDeviceInput deviceInputWithDevice:inputDevice error:&error];
if ([session canAddInput:deviceInput]) {
[session addInput:deviceInput];
}
AVCaptureVideoPreviewLayer *previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session];
[previewLayer setVideoGravity:AVLayerVideoGravityResizeAspectFill];
CGRect frame = view_cameraModeView.frame;
[previewLayer setFrame:frame];
CALayer *rootLayer = [[self view] layer];
[rootLayer setMasksToBounds:YES];
[rootLayer insertSublayer:previewLayer atIndex:0];
stillImageOutput = [[AVCaptureStillImageOutput alloc] init];
NSDictionary *outputSettings = [[NSDictionary alloc] initWithObjectsAndKeys:AVVideoCodecJPEG,AVVideoCodecKey, nil];
[stillImageOutput setOutputSettings:outputSettings];
[session addOutput:stillImageOutput];
[session startRunning];
}
Now, I want to add control buttons to be able to change mode to front camera and as well to turn auto flash mode on or off as shown in given picture. How can i do this? Can anyone suggest me?
asked 1 min ago
How to set Auto flash mode and front camera in custom build IOS camera
Aucun commentaire:
Enregistrer un commentaire