Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AVCaptureVideoPreviewLayer with the ability to record in landscape mode with Quicktime

So I currently have a camera app. I have it so it only works in portrait mode but you can still record videos and take photos in landscape mode fine. I use the following code to handle that:

videoConnection?.videoOrientation = self.orientation()

However, since the app does not register landscape mode itself you can not record the screen via quicktime in landscape (it stays portrait) (quicktime>file>record movie>choose device name)

Is there a way to fix this? I don't need to actually change the anything about the device to support landscape, I just want the ability to be able to record it that way in quicktime but nothing in the UI needs to be changed.

like image 529
Jonovono Avatar asked Jun 30 '15 02:06

Jonovono


1 Answers

You can set call beginGeneratingDeviceOrientationNotifications for UIDevice and subscribe to UIDeviceOrientationDidChangeNotification. Afterward you can use orientation property of UIDevice in your code.

Reference Apple documentation for UIDevice class for details.

like image 119
Nikita Leonov Avatar answered Sep 19 '22 13:09

Nikita Leonov