avcapture

Method to find device's camera resolution iOS

落花浮王杯 提交于 2019-11-26 19:03:30
问题 Whats the best method to find the image resolution going to be captured using setting AVCaptureSessionPresetPhoto . I am trying to find the resolution before capturing the image. 回答1: With the function below, you can programmatically get the resolution from activeFormat before capture begins, though not before adding inputs and outputs: https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVCaptureDevice_Class/index.html#//apple_ref/occ/instp/AVCaptureDevice

AVCaptureVideoPreviewLayer orientation - need landscape

て烟熏妆下的殇ゞ 提交于 2019-11-26 15:25:39
问题 My app is landscape only. I'm presenting the AVCaptureVideoPreviewLayer like this: self.previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session]; [self.previewLayer setBackgroundColor:[[UIColor blackColor] CGColor]]; [self.previewLayer setVideoGravity:AVLayerVideoGravityResizeAspect]; NSLog(@"previewView: %@", self.previewView); CALayer *rootLayer = [self.previewView layer]; [rootLayer setMasksToBounds:YES]; [self.previewLayer setFrame:[rootLayer bounds]]; NSLog(@