I am creating a custom camera with a small preview area inside the iPad, however the stream in this preview is rotated clockwise.
I reviewed both the AVCam demo and the SquareCam demo on Apple, and I don't see a solution either. All AVFoundation orientation streams in StackOverflow specifically relate to output orientation, not input orientation.
Here is the session code I'm using:
AVCaptureDevice *frontalCamera = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; _session = [[AVCaptureSession alloc] init]; [_session beginConfiguration]; NSError *error; AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:frontalCamera error:&error]; [_session addInput:input]; _output = [[AVCaptureStillImageOutput alloc] init]; [_output setOutputSettings:[[NSDictionary alloc] initWithObjectsAndKeys:AVVideoCodecJPEG,AVVideoCodecKey,nil]]; [_session addOutput:_output]; AVCaptureVideoPreviewLayer *previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:_session]; previewLayer.frame = self.imageViewCamera.bounds; previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill; [self.imageViewCamera.layer addSublayer:previewLayer]; _session.sessionPreset = AVCaptureSessionPreset640x480; [_session commitConfiguration]; [_session startRunning];
Any help would be greatly appreciated!
source share