[TIMOB-19597] Android: Add previewRect (height, width) to camera callback
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-02-02T08:22:18.000+0000 |
Affected Version/s | Release 4.1.1 |
Fix Version/s | Release 5.2.0 |
Components | Android |
Labels | android, camera, module_media, qe-manualtest, qe-testadded |
Reporter | Michael Gangolf |
Assignee | Srikanth Sombhatla |
Created | 2015-09-17T16:32:42.000+0000 |
Updated | 2016-02-04T02:00:56.000+0000 |
PR: https://github.com/appcelerator/titanium_mobile/pull/7201
With this PR, user can get the preview size and can use it to size the captured image accordingly.
Reopening as no previewRect is seen in the logs but only cropRect:
Environment: Appc Studio : 4.5.0.201601210853 Ti SDK : 5.2.0.v20160114021251 Ti CLI : 5.0.6 Alloy : 1.7.33 MAC Yosemite : 10.10.5 Appc NPM : 4.2.3-1 Appc CLI : 5.2.0-231 Node: v0.12.27 Nexus 6P - Android 6.0 Galaxy S3 - Android 4.4.2
[~lchoudhary] Looks like the PR is intended when showCamera is used with overlay and
takePicture
is called. -[~michael] please provide a complete working app.js. -[~lchoudhary] You can use this app.js
Also there is a dependency on TIMOB-19769 which will crash when camera overlay is used.
Thanks for the example! It only works when takePicture() is called (so not with the basic camera controls). The other callback should be here https://github.com/ashcoding/titanium_mobile/blob/da0ba48a38b07142e53a99ca1af7023ee727af5f/android/modules/media/src/java/ti/modules/titanium/media/MediaModule.java#L952 but I need to see how I get the getOptimalPreviewSize() value there
[~michael] previewRect makes sense when used with overlay, because native camera control is not used when a overlay is provided in
showCamera
. -In such case thepreviewRect
should be {-1, -1} as withcropRect
.- The same should be updated in docs. Can you update the PR accordingly ? -It can be updated here https://github.com/ashcoding/titanium_mobile/blob/da0ba48a38b07142e53a99ca1af7023ee727af5f/android/modules/media/src/java/ti/modules/titanium/media/MediaModule.java#L917-Sure I'll do that! Thanks for the hint. Will update the PR in the next days
output of showCamera without camera overlay will not have previewRect
PR: https://github.com/appcelerator/titanium_mobile/pull/7660
Updates to documentation 5_2_X PR: https://github.com/appcelerator/titanium_mobile/pull/7665 master PR: https://github.com/appcelerator/titanium_mobile/pull/7666
5_2_X (7665) and Master (7666) PR for documentation merged.
Should I leave it like it is now (undefined if its not used). Or should I create a correct PR with -1?
[~michael] You can leave it like that. We just added the documentation changes. Thanks for the effort!
[~lchoudhary] Sorry for the confusion. We made that behaviour inline with other properties such that it is undefined when not present. To recap
previewRect
is present when camera overlay is used. Other cases it is undefined.Verified the addition of previewRect(height,width). We see previewRect in the logs only when camera overlay is used. Closing. Environment: Appc Studio : 4.5.0.201601262138 Ti SDK : 5.2.0.v20160203093451 Ti CLI : 5.0.6 Alloy : 1.7.33 MAC Yosemite : 10.10.5 Appc NPM : 4.2.3-2 Appc CLI : 5.2.0-242 Node: 4.2.2 Nexus 6P - Android 6.0