-
Notifications
You must be signed in to change notification settings - Fork 875
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
Landscape preview distorted / zoomed #73
Comments
Galaxy Tab 2 10.1, the same story. |
Anyone figured out how to fix this? |
@getupcast Would you be willing to submit a Pull Request for this? |
I've been able to resolve this. In Camera1.Java, line 14:
Is not always set correctly. The device arbitrarily sets it to 0, even if the device is rotated. I decided to create a new boolean to store whether or not the device is in landscape or not, and base this on displayOrientation, which seems to be set consistently:
Later in line 473, the previewSize is inverted based on the device orientation:
I switched this to my new boolean:
Secondly, on line 616, the mPreview previewParameters are also set based on the deviceOrientation, but on top of that, invertPreviewSizes is used to flip height and width:
Here I also switched to my new boolean instead of mDeviceOrientation to check what is required, but I only use this information to determine whether to invert height and weight. I don't think it makes sense to first set the preview on width/height or vice/versa, but then invert again. So the new code ended up being:
Tested on Samsung S8 Android 7.0 and preview shows correctly in both Landscape and Portrait. Hope this helps to resolve this across the board for all devices. |
@austinkettner sorry was logged in under corporate account. I can't really do a pull request because I made many other changes specific to my implementation that may muddy the waters.... |
Understood @rogerdcarvalho we will get this in soon =) |
Is this in the code yet? I am getting the issue on Samsung |
@harishvishwakarma Can you test this in the 1.0.0 PR? #318 - should be resolved, but if not let me know! |
@austinkettner : It is resolved in the mentioned PR. I am very much impressed at how much easy this makes Camera implementation. Thanks for the library.
|
Glad it's working much better in the 1.0.0! Can you please comment in the PR with 1-3, we will add documentation for this shortly. Documentation as a whole for 1.0.0 is still coming, so we plan on having a fully dedicated documentation site ahead of merging. |
Tested on Samsung tab and phone and I have a problem with when rotating to landscape the camera image looks zoomed in. It is fine on portrait mode and the captured preview is displaying ok on both landscape and portrait. Is there a fix for this.
The text was updated successfully, but these errors were encountered: