Skip to content

Commit 01b5810

Browse files
committed
Fix customPreviewLayer layout issue when rotateVideo is NO in iOS
1 parent 438e456 commit 01b5810

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

modules/videoio/src/cap_ios_video_camera.mm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ - (void)createVideoDataOutput;
353353
// create a custom preview layer
354354
self.customPreviewLayer = [CALayer layer];
355355
self.customPreviewLayer.bounds = CGRectMake(0, 0, self.parentView.frame.size.width, self.parentView.frame.size.height);
356-
[self layoutPreviewLayer];
356+
self.customPreviewLayer.position = CGPointMake(self.parentView.frame.size.width/2., self.parentView.frame.size.height/2.);
357+
[self updateOrientation];
357358

358359
// create a serial dispatch queue used for the sample buffer delegate as well as when a still image is captured
359360
// a serial dispatch queue must be used to guarantee that video frames will be delivered in order

0 commit comments

Comments
 (0)