Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Diff of /modules/highgui/src/cap_ios_abstract_camera.mm [8cbb28] .. [9a98cd] Maximize Restore

  Switch to side-by-side view

--- a/modules/highgui/src/cap_ios_abstract_camera.mm
+++ b/modules/highgui/src/cap_ios_abstract_camera.mm
@@ -278,9 +278,21 @@
 {
     self.captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:self.captureSession];
 
-    if ([self.captureVideoPreviewLayer isOrientationSupported]) {
-        [self.captureVideoPreviewLayer setOrientation:self.defaultAVCaptureVideoOrientation];
-    }
+    if ([self.captureVideoPreviewLayer respondsToSelector:@selector(connection)])
+	{
+		if ([self.captureVideoPreviewLayer.connection isVideoOrientationSupported])
+		{
+			[self.captureVideoPreviewLayer.connection setVideoOrientation:self.defaultAVCaptureVideoOrientation];
+		}
+	}
+	else
+	{
+		// Deprecated in 6.0; here for backward compatibility
+		if ([self.captureVideoPreviewLayer isOrientationSupported])
+		{
+			[self.captureVideoPreviewLayer setOrientation:self.defaultAVCaptureVideoOrientation];
+		}                
+	}
 
     if (parentView != nil) {
         self.captureVideoPreviewLayer.frame = self.parentView.bounds;