rFlex / SCRecorder

iOS camera engine with Vine-like tap to record, animatable filters, slow motion, segments editing
Apache License 2.0
3.06k stars 583 forks source link

SCSwipeableFilterView with wrong contentMode and Video stretched on iPhone X #416

Closed gutiago closed 1 year ago

gutiago commented 6 years ago

So, I'm using SCSwipeableFilterView on my project, it works well on all devices, when using SCSwipeableFilterView. But, when I run on a iPhone X, my video gets stretched. For some reason, it does not respect the content mode applied. Does anyone know how to solve it?

HackShitUp commented 6 years ago

I had the same issue. I was using this in conjunction with GPUImage, and I found out that I had to pre-configure the camera's frame/resolutions size for the iPhone X, or else the filter view would stretch the image or video.

hardik99 commented 5 years ago

I am facing the same issue with iPhone X. I have used SCFilterImageView. @gutiago @HackShitUp let me know if you have found any solution for this.

HackShitUp commented 5 years ago

@gutiago @hardik99 if you're using the GPUImage dependency, I resized the camera target size to ensure that the content of the image or video is equal to the filter view

gutiago commented 5 years ago

I've ended up changing the size of the view displaying the video content. I've put it in a 16:9 resolution and the background color was set to black. I tried a lot of things, even change de content mode of the internal classes, but without success.

HackShitUp commented 5 years ago

@gutiago so it was resolved? I think it has less to do with SCRecorder's contentMode but the content of the image or video asset itself

gutiago commented 5 years ago

Yes, I it worked! I mean, I think it's a good approach to solve this situation. If your app really needs to display the video on the entire screen on the X, I have no idea how to help. And also, if I'm not wrong, constraining the view to Safe Area, reduced the sensation of a stretch image.

Twinkle24IT commented 5 years ago

@HackShitUp I am also facing same issue in iPhone X . My app needs to display video in full screen . Did you found any solution for that issue? If yes than Can you please share code with me?

TwinkleMali commented 5 years ago

Hi @gutiago I am also facing same issue in iPhone X only. i am also trying to do so same thing which you have done to fix that issue. I am adding filter switcher view as subview in my own view programmatically . And tried to change ratio of that filter switcher view but there is no difference i can see. Can you please help with how did you set aspect ratio 16:9?

Thanks

azbuky commented 5 years ago

For anyone still needing this, I managed to fixed the issue by cropping the image to the required rect in SCImageView.m - scaleAndResizeCIImage:forRect:

         verticalScale = horizontalScale;
     }

-    return [image imageByApplyingTransform:CGAffineTransformMakeScale(horizontalScale, verticalScale)];
+    image = [image imageByApplyingTransform:CGAffineTransformMakeScale(horizontalScale, verticalScale)];
+    rect.origin.x = CGRectGetMidX(image.extent) - CGRectGetMidX(rect);
+    rect.origin.y = CGRectGetMidY(image.extent) - CGRectGetMidY(rect);
+    return [image imageByCroppingToRect:rect];
 }

 - (void)drawRect:(CGRect)rect {
hiteshpatel1992 commented 3 years ago

For anyone still needing this, I managed to fixed the issue by cropping the image to the required rect in SCImageView.m - scaleAndResizeCIImage:forRect:

         verticalScale = horizontalScale;
     }

-    return [image imageByApplyingTransform:CGAffineTransformMakeScale(horizontalScale, verticalScale)];
+    image = [image imageByApplyingTransform:CGAffineTransformMakeScale(horizontalScale, verticalScale)];
+    rect.origin.x = CGRectGetMidX(image.extent) - CGRectGetMidX(rect);
+    rect.origin.y = CGRectGetMidY(image.extent) - CGRectGetMidY(rect);
+    return [image imageByCroppingToRect:rect];
 }

 - (void)drawRect:(CGRect)rect {

still it is stretching in the perivew