Comments (6)
You can use whatever aspect ratio you want with your camera configuration
val aspectRatio = aspectRatio(metrics.widthPixels, metrics.heightPixels)
this is how it is implemented for now, you can change it to smth like this
val aspectRatio = aspectRatio(1920, 908)
I believe this should work
from camerax-demo.
As aspectRatio()
returns only 16/9 and 4/3 - preview still stretching and video res still 1920x1080 (note that I want to place my preview on whole screen).
P.S: when I run android/camera-samples Camera2Video project (with list of resolutions on cameras) - I didn't found 1920x908. It is possible that my device just cutting video on hardware level or something?
from camerax-demo.
I think it depends on lib version you are using. In the version used in sample you can set ratio as I wrote in previous comment.
from camerax-demo.
If we talk about VideoFragment, aspectRatio()
fun is:
private fun aspectRatio(width: Int, height: Int): Int {
val previewRatio = max(width, height).toDouble() / min(width, height)
if (abs(previewRatio - RATIO_4_3_VALUE) <= abs(previewRatio - RATIO_16_9_VALUE)) {
return AspectRatio.RATIO_4_3
}
return AspectRatio.RATIO_16_9
}
So it returns only 16_9 and 4_3. Both ratios impossible to fit in 19:9 without stretching or cutting.
Or I don't understand something?(
Also I tried .setTargetResolution()
istead of .setTargetAspectRatio()
- same result.
from camerax-demo.
No you are correct. This are the ratios supported by CameraX. You can try to set resolution, but I think it will not change the ratio.
from camerax-demo.
I'm closing the issue since the issue you mentioned is in fact an API restriction by CameraX
from camerax-demo.
Related Issues (20)
- Configuration issue HOT 3
- No file of this HOT 1
- device: Samsung s20 Android version: 11 keep crashing app when open the application --> Caused by: java.lang.RuntimeException: Error retrieving camcorder profile params HOT 1
- CameraxDemo is not working for below api level 29 HOT 6
- Camera Record not working and i didn't get video record thumbnail and video file. HOT 4
- Honor not saving image in DCIM HOT 4
- Ensure focused before taking photo HOT 4
- how to access external cameras using Android cameraX
- This example won't run - you have an old gradle .... ..... ..... HOT 8
- video flip HOT 1
- Android 11 Torch is not working HOT 4
- Unable to open project due to old Gradle version HOT 1
- Hi sir this is not an issue but a new feature
- 旋转手机拍摄后,照片无法自动纠正方向。 HOT 1
- Preview library(gallery)
- fetcher coil deprecated
- Switch photo and video mode without stop camera effect HOT 1
- Can't launch camera HOT 4
- Crash while record Video HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from camerax-demo.