Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gutiago opened this issue Jan 24, 2018 · 10 comments
Closed

Comments

@gutiago
Copy link

gutiago commented Jan 24, 2018

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
Copy link

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
Copy link

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
Copy link

@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
Copy link
Author

gutiago commented Jul 16, 2018

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
Copy link

@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
Copy link
Author

gutiago commented Jul 16, 2018

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
Copy link

@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
Copy link

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
Copy link

azbuky commented Jul 6, 2019

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
Copy link

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

@gutiago gutiago closed this as completed Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants