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

while setting the setVideoSize for the recording getting error with the size #1277

Open
ThiruVenket opened this issue Apr 18, 2024 · 0 comments

Comments

@ThiruVenket
Copy link

SizeSelector width = SizeSelectors.minWidth(Utility.WIDTH);
SizeSelector height = SizeSelectors.minHeight(Utility.HEIGHT);
SizeSelector dimensions = SizeSelectors.and(width, height); // Matches sizes bigger than width X height
SizeSelector ratio = SizeSelectors.aspectRatio(AspectRatio.of(1, 2), 0); // Matches 1:2 sizes.
SizeSelector ratio3 = SizeSelectors.aspectRatio(AspectRatio.of(2, 3), 0); // Matches 2:3 sizes.
SizeSelector ratio2 = SizeSelectors.aspectRatio(AspectRatio.of(9, 16), 0); // Matches 9:16 sizes.
SizeSelector result = SizeSelectors.or(
SizeSelectors.and(ratio, dimensions),
SizeSelectors.and(ratio2, dimensions),
SizeSelectors.and(ratio3, dimensions)
);

camera.setVideoSize(result);

while i try to set the video size based on the screen aspect ratio getting error like below

Session 1: Failed to create capture session; configuration failed
2024-04-18 10:36:45.265 13580-15968 CameraEngine E onConfigureFailed! Session android.hardware.camera2.impl.CameraCaptureSessionImpl@169617
2024-04-18 10:36:45.265 13580-15968 CameraEngine E onConfigureFailed! onConfigureFailed! Session android.hardware.camera2.impl.CameraCaptureSessionImpl@169617

for this i have changed as below

camera.setVideoSize(SizeSelectors.and(SizeSelectors.maxWidth(MAX_WIDTH), SizeSelectors.smallest()));

after that am able to record the video with out issue but the resolution of the video is too low

camera.setVideoSize(SizeSelectors.and(SizeSelectors.maxWidth(MAX_WIDTH), SizeSelectors.biggest()));

when trying this same above error is came

how to solve the resolution issue based on the device spec.

Please suggest

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

1 participant