Posts

Post not yet marked as solved
1 Replies
804 Views
Device: iPad Pro 10.5-inchIOS: 10.3.2 10.3.3I use the following function to take a snapshot in the app.UIView (UISnapshotting) - (BOOL) drawViewHierarchyInRect: (CGRect) rect afterScreenUpdates: (BOOL) afterUpdates;CGRect rect = self.view.bounds; UIGraphicsBeginImageContextWithOptions(rect.size, NO, [[UIScreen mainScreen] scale]); [self.view drawViewHierarchyInRect:rect afterScreenUpdates:YES]; UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();However, every time I use this feature, the Camera preview rendering by AVFoundation used in another part of the application became slow. self.session = [[AVCaptureSession alloc] init]; AVCaptureDevice *camera = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; self.input = [[AVCaptureDeviceInput alloc] initWithDevice:camera error:&error]; [self.session addInput:self.input]; self.output = [[AVCapturePhotoOutput alloc] init]; [self.session addOutput:self.output]; self.prevLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:self.session]; self.prevLayer.frame = self.previewView.layer.bounds; self.prevLayer.videoGravity = AVLayerVideoGravityResizeAspectFill; switch ([[UIApplication sharedApplication] statusBarOrientation]) { case UIInterfaceOrientationLandscapeLeft:{ AVCaptureConnection *con = self.prevLayer.connection; con.videoOrientation = AVCaptureVideoOrientationLandscapeLeft; } break; case UIInterfaceOrientationLandscapeRight:{ AVCaptureConnection *con = self.prevLayer.connection; con.videoOrientation = AVCaptureVideoOrientationLandscapeRight; } break; case UIInterfaceOrientationPortrait:{ AVCaptureConnection *con = self.prevLayer.connection; con.videoOrientation = AVCaptureVideoOrientationPortrait; } break; case UIInterfaceOrientationPortraitUpsideDown:{ AVCaptureConnection *con = self.prevLayer.connection; con.videoOrientation = AVCaptureVideoOrientationPortraitUpsideDown; } break; default: break; } [self.previewView.layer addSublayer:self.prevLayer]; [self.session startRunning];Currently we are seeing this problem only in the above device and OS environment.Anyone can solve this? I need information that will lead to resolution.
Posted
by design.
Last updated
.