Created
July 14, 2015 20:20
-
-
Save mattdeboard/aa94b2a584cfc3d2103b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func videoOrientation() { | |
let previewConn = self.previewLayer?.connection | |
let orientation = UIApplication.sharedApplication().statusBarOrientation | |
switch orientation { | |
case UIInterfaceOrientation.LandscapeLeft: | |
previewConn!.videoOrientation = AVCaptureVideoOrientation.LandscapeLeft | |
case UIInterfaceOrientation.LandscapeRight: | |
previewConn!.videoOrientation = AVCaptureVideoOrientation.LandscapeRight | |
case UIInterfaceOrientation.Portrait: | |
previewConn!.videoOrientation = AVCaptureVideoOrientation.Portrait | |
case UIInterfaceOrientation.PortraitUpsideDown: | |
previewConn!.videoOrientation = AVCaptureVideoOrientation.PortraitUpsideDown | |
default: | |
previewConn!.videoOrientation = AVCaptureVideoOrientation.LandscapeRight | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment