I am developing an augmented reality game, and I\'ve encountered an issue with the orientation of the camera view when the orientation lock of the device is on.
I a
The reason why your Preview layer is not orientating is due the fact that you are using deprecated API and moreover you are not updating the Video orientation at the change of device orientation.
Remove the deprecated API i.e in your code instead of
captureVideoPreviewLayer.orientation
use videoOrientation property i.e
captureVideoPreviewLayer.connection.videoOrientation
Update the video orientation in shouldAutorotate as follows:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(interfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
captureVideoPreviewLayer.connection.videoOrientation = AVCaptureVideoOrientationLandscapeRight
}
// and so on for other orientations
return ((interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}