lxy 1 year ago
parent
commit
a1f5f8b988

+ 13 - 2
LenzCameraNativeModuleForRN/Classes/inner/PCSBaseViewController/PCSBaseViewController.m

@@ -1373,7 +1373,17 @@
     }
     [camera unlockForConfiguration];
     self.thumbnailOritaionByCurrentVideoOrientation = [UIImage imageOrientationByDeviceOrientation:currOrientation isFrontCamera:camera == [CameraManager shared].front];
-    
+    if (connection.supportsVideoOrientation) {
+        if (self.currentTgDirection == TgDirectionLeft) {
+            connection.videoOrientation = AVCaptureVideoOrientationLandscapeRight;
+        } else if (self.currentTgDirection == TgDirectionRight) {
+            connection.videoOrientation = AVCaptureVideoOrientationLandscapeLeft;
+        } else if (self.currentTgDirection == TgDirectionPortrait) {
+            connection.videoOrientation = AVCaptureVideoOrientationPortrait;
+        } else {
+            connection.videoOrientation = AVCaptureVideoOrientationPortraitUpsideDown;
+        }
+    }
     [self.movieFileOutput startRecordingToOutputFileURL: tmpMovieFileUrl recordingDelegate:self];
 
     return YES;
@@ -2917,7 +2927,8 @@
     }];
     
     itemModel.mode = self.mode;
-    itemModel.previewImage = [self videoFrameImageWith:outputFileURL];
+    
+    itemModel.previewImage = [self rotateImageWith:[self videoFrameImageWith:outputFileURL]];
     [self.resourceModel.movieArray addObject:itemModel];
     self.resourceModel.lastIndex = self.mode;