I use AVCam made by apple for my custom camera view. Honestly, it’s not easy to understand what is going on in the AVCamViewController class if you see it for the first time.
Now I wonder how they set the frame of the captured image. I tried to find where some stylists or something like that, but I did not find them.
I searched on Google and found the answer here AVCam is not in full screen
But when I implemented this solution, I realized that he just made a real-time preview layer with the same size as my view, but when the application saves the image in the - (IBAction)snapStillImage:(id)sender method in the gallery, the images were still with two stripes on the left and right.
My question is how to remove these stripes or in which line in the apple source code to install this stuff?
As well as an additional subquery, how can I set the type, create only a photo, because the application asks me for “Microphone settings”, and I don’t need it, I just need to take a photo and what it is.
This code from Apple sources will save the image in the photo library.
- (IBAction)snapStillImage:(id)sender { dispatch_async([self sessionQueue], ^{ // Update the orientation on the still image output video connection before capturing. [[[self stillImageOutput] connectionWithMediaType:AVMediaTypeVideo] setVideoOrientation:[[(AVCaptureVideoPreviewLayer *)[[self previewView] layer] connection] videoOrientation]]; // Flash set to Auto for Still Capture [AVCamViewController setFlashMode:AVCaptureFlashModeAuto forDevice:[[self videoDeviceInput] device]]; // Capture a still image. [[self stillImageOutput] captureStillImageAsynchronouslyFromConnection:[[self stillImageOutput] connectionWithMediaType:AVMediaTypeVideo] completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) { if (imageDataSampleBuffer) { NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer]; UIImage *image = [[UIImage alloc] initWithData:imageData]; UIImage *proccessingImage = [SAPAdjustImageHelper adjustImage:image]; NSNumber *email_id = [SAPCoreDataEmailHelper currentEmailId]; [SAPFileManagerHelper addImage:proccessingImage toFolderWithEmailId:email_id]; } }]; }); }
ios objective-c avcam avcapturesession
Matrosov Alexander
source share