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
feat(android): use cameraX #12395
feat(android): use cameraX #12395
Conversation
|
added |
Added output image parameters: var cameraSizes = Ti.Media.cameraOutputSizes;
for (var i=0; i<cameraSizes.length;++i){
console.log(cameraSizes[i].cameraType);
console.log(cameraSizes[i].values);
} to get the potential sizes. And you can set them with: targetImageWidth: 800,
targetImageHeight: 600, |
some new additions that makes working with overlays a lot easier:
having the preview only be FIT (full width) makes it easier to work with overlays: |
added the old files back. The new cameraX part is used when you set |
Let's take this in and give it some testing during the next 1-2 releases. If it runs smooth, we can make it default after that 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more feedback - mostly questions to be sure! One general thing: As the code is pretty separated now, wouldn't it make sense to wrap it up inside a module to be able to quickly iterate on it, then include it to the SDK once stable? We did the same with ti.wkwebview back then.
platforms: [android] | ||
since: "12.1.0" | ||
|
||
- name: VERTICAL_ALIGN_TOP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefix this constants to be more distinctive regarding other ones?
} else if (videoRecordEvent instanceof VideoRecordEvent.Pause) { | ||
// Handle the case where the active recording is paused | ||
} else if (videoRecordEvent instanceof VideoRecordEvent.Resume) { | ||
// Handles the case where the active recording is resumed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More events useful?
android/modules/media/src/java/ti/modules/titanium/media/TiCameraXActivity.java
Show resolved
Hide resolved
android/modules/media/src/java/ti/modules/titanium/media/TiCameraXActivity.java
Outdated
Show resolved
Hide resolved
android/modules/media/src/java/ti/modules/titanium/media/TiCameraXActivity.java
Outdated
Show resolved
Hide resolved
android/modules/media/src/java/ti/modules/titanium/media/TiCameraXActivity.java
Show resolved
Hide resolved
} | ||
if (camera != null) { | ||
camera = null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any more strong references, e.g. callbackContext
and overlayProxy
? It would be good to run the profiler for any memory leaks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I'll check that. The current TiCameraActivity doesn't do more so if that works fine it will be the same in TiCameraXActivity.
Thanks for the feedback! Already adjusted most of it!
I did so much work here already that I don't want to rip it out and create a module. I think more people test it if we just say "enable useCameraX" and don't have to add a module. It would be different too (no My idea would be: If the new features have to be changed it will be in a minor bugfix release as they are "new features" that won't break existing apps. There wasn't any demand for those features so they aren't time critical (and they are Android only). |
Totally fine! Let's merge it and await the feedback! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work, really excited to use this in production apps soon!
awesome! Thanks! |
* camerax overlay * close camera * android back, switch lens * flash * save image * video start * change video camera * bit rate, max resolution, bug fixes * update library version * remove old files * version update, permission check * version update * max video duration * update video part * get video from gallery, add recording callback * image: save to gallery * error msg, clean up recordings * cleanup * pinch to zoom * revert Android studio styling * docs: remove empty description * update camerax version * update * min/maxZoomLevel, zoomLevel * final version * update * move try/catch * torch, set flash mode * remove duplicated code * read camera sizes and be able to set them * raise cameraX library * aspectRatio, open callback, scalingMode * verticalAlign * add old camera files again * better defaults * minor update to camerax version * update files
JIRA: https://jira-archive.titaniumsdk.com/AC-6676
Fixes #13525
Optional Description:
Will use CameraX on Android when using a camera with an overlay
Features:
targetImageWidth
andtargetImageHeight
Ti.Media.cameraOutputSizes
to get the camera output sizesminZoomLevel
,maxZoomLevel
andzoomLevel
to set the zoom in codeopen
callback with preview size return valuesaspectRatio
withTi.Media.ASPECT_RATIO_16_9
andTi.Media.ASPECT_RATIO_4_3
scalingMode
withTi.Media.IMAGE_SCALING_ASPECT_FIT
andTi.Media.IMAGE_SCALING_ASPECT_FILL
verticalAlign
withTi.Media.VERTICAL_ALIGN_BOTTOM
,Ti.Media.VERTICAL_ALIGN_TOP
,Ti.Media.VERTICAL_ALIGN_CENTER
useCameraX
parameterTested:
16:9 image with ASPECT_FILL
16:9 image with ASPECT_FIT