iPhone AVFoundation camera orientation

Well, it’s taken me fracking forever but I’ve done it!

The bit of code I was looking for is

[UIDevice currentDevice].orientation;

This goes in as so

AVCaptureConnection *videoConnection = [CameraVC connectionWithMediaType:AVMediaTypeVideo fromConnections:[imageCaptureOutput connections]];
if ([videoConnection isVideoOrientationSupported])
{
    [videoConnection setVideoOrientation:[UIDevice currentDevice].orientation];
}

And it works perfectly 😀

Woop woop!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)