{ "id": "170394", "key": "TIMOB-25565", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "20060", "description": "", "name": "Release 7.0.2", "archived": false, "released": true, "releaseDate": "2018-02-09" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-01-24T22:25:36.000+0000", "created": "2017-11-20T16:11:53.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [], "versions": [ { "id": "16980", "description": "New V8", "name": "Release 6.0.0", "archived": false, "released": true, "releaseDate": "2016-11-15" } ], "issuelinks": [], "assignee": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-01-25T00:17:01.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "Using an `overlay` in `Ti.Media.showCamera()` requires to capture picture programmatically using `Ti.Media.takePicture()` method, but when used with `autohide:false`, the `success` callback is fired repeatedly on my Moto G4 Play device. This Moto device is able to auto-focus perfectly & that's why the console shows the relevant log but it's certainly a bug as it's impossible to create a custom-overlay camera feature to capture pics continuously without closing the camera. \r\n\r\nOn the other hand, my Samsung On5 device was not firing success callback multiple times but it was also not able to auto-focus on things. So it seems the issue is related to auto-focus feature which is very much required & thus making overlay useless on my Moto G4 Play device.\r\n\r\n*Steps to reproduce:*\r\n1- Tap 'Open Camera' button\r\n2- Tap `Take Picture` button & do not press back button in order to keep camera window open\r\n3- Try to notice if your device is able to auto-focus or not by moving the camera around quickly.\r\n4- If your device is able to auto-focus on different objects, then only success callback will be fired multiple times.\r\n\r\nHere's a sample code for this:\r\n\r\n\r\n{code:javascript}\r\nvar view = Ti.UI.createView({\r\n height : Ti.UI.SIZE,\r\n width : Ti.UI.SIZE,\r\n bottom : 50\r\n});\r\n\r\nvar button = Ti.UI.createButton({\r\n title:' Take Picture '\r\n});\r\nbutton.addEventListener('click', function () { Ti.Media.takePicture(); });\r\n\r\nview.add(button);\r\n\r\n\r\nvar captureBtn = Ti.UI.createButton({\r\n title:' Open Camera ',\r\n});\r\ncaptureBtn.addEventListener('click', startCamera);\r\n\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor : \"#e4e2df\"\r\n});\r\nwin.add(captureBtn);\r\nwin.open();\r\n\r\nfunction startCamera() {\r\n if (Ti.Media.hasCameraPermissions()) {\r\n showCamera();\r\n } else {\r\n Ti.Media.requestCameraPermissions(function (e) {\r\n e.success && showCamera();\r\n });\r\n }\r\n}\r\n\r\nfunction showCamera() {\r\n Ti.Media.showCamera({\r\n autohide : false,\r\n saveToPhotoGallery : true,\r\n overlay : view,\r\n success : function(e) {\r\n Ti.API.info('Path = ' + e.media.nativePath);\r\n }\r\n });\r\n}\r\n{code}\r\n\r\nHere's the output of this code on Moto G4 Play device:\r\n\r\n\r\n{code:java}\r\n[INFO] : Path = file:///storage/emulated/0/Pictures/Titanium Android Samples/tia-1117983170.jpg\r\n[WARN] : TiCameraActivity: (main) [5721,41280] Unable to focus.\r\n[INFO] :\r\n[INFO] : Path = file:///storage/emulated/0/Pictures/Titanium Android Samples/tia341194327.jpg\r\n[WARN] : TiCameraActivity: (main) [768,42048] Unable to focus.\r\n[INFO] :\r\n[INFO] : Path = file:///storage/emulated/0/Pictures/Titanium Android Samples/tia-679926680.jpg\r\n[WARN] : TiCameraActivity: (main) [685,42733] Unable to focus.\r\n[INFO] :\r\n[INFO] : Path = file:///storage/emulated/0/Pictures/Titanium Android Samples/tia433451119.jpg\r\n[WARN] : TiCameraActivity: (main) [599,43332] Unable to focus.\r\n[INFO] :\r\n[INFO] : Path = file:///storage/emulated/0/Pictures/Titanium Android Samples/tia-1426643918.jpg\r\n[WARN] : TiCameraActivity: (main) [398,43730] Unable to focus.\r\n[INFO] :\r\n[INFO] : Path = file:///storage/emulated/0/Pictures/Titanium Android Samples/tia1408998036.jpg\r\n[WARN] : TiCameraActivity: (main) [282,44012] Unable to focus.\r\n[INFO] :\r\n[INFO] : Path = file:///storage/emulated/0/Pictures/Titanium Android Samples/tia-625031907.jpg\r\n[WARN] : TiCameraActivity: (main) [970,44982] Unable to focus.\r\n{code}\r\n\r\nHere's is the Java code link causing this issue : https://github.com/appcelerator/titanium_mobile/blob/949d3cda48dbf98381cbdcbad191d48cd4868df7/android/modules/media/src/java/ti/modules/titanium/media/TiCameraActivity.java\r\n", "attachment": [], "flagged": false, "summary": "Android: Ti.Media.showCamera with an overlay fires success callback multiple times on some devices", "creator": { "name": "prashant_saini", "key": "prashant_saini", "displayName": "Prashant Saini", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "prashant_saini", "key": "prashant_saini", "displayName": "Prashant Saini", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Ti SDK 6.3.0.GA\r\nAndroid OS - 6.0.1\r\nDevice - Moto G4 Play", "closedSprints": [ { "id": 978, "state": "closed", "name": "2017 Sprint 25 SDK", "startDate": "2017-12-03T23:22:15.144Z", "endDate": "2017-12-17T23:22:00.000Z", "completeDate": "2017-12-18T22:32:02.770Z", "originBoardId": 114 }, { "id": 984, "state": "closed", "name": "2017 Sprint 26 SDK", "startDate": "2017-12-17T22:34:59.726Z", "endDate": "2017-12-31T22:34:00.000Z", "completeDate": "2018-01-02T16:57:05.655Z", "originBoardId": 114 }, { "id": 985, "state": "closed", "name": "2018 Sprint 01 SDK", "startDate": "2017-12-31T16:58:54.631Z", "endDate": "2018-01-14T16:58:00.000Z", "completeDate": "2018-01-17T22:44:27.028Z", "originBoardId": 114 }, { "id": 990, "state": "closed", "name": "2018 Sprint 02 SDK", "startDate": "2018-01-14T22:48:43.544Z", "endDate": "2018-01-28T22:48:00.000Z", "completeDate": "2018-01-29T16:22:42.911Z", "originBoardId": 114 }, { "id": 975, "state": "closed", "name": "2017 Sprint 24 SDK", "startDate": "2017-11-19T18:59:24.352Z", "endDate": "2017-12-03T18:59:00.000Z", "completeDate": "2017-12-04T23:20:14.151Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "431371", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello [~prashant_saini], \r\nAre you still having the issue? Can you try in another device using Android api (27) and let us know how it goes.\r\n\r\nBest", "updateAuthor": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2017-11-28T09:54:03.000+0000", "updated": "2017-11-28T09:54:03.000+0000" }, { "id": "431381", "author": { "name": "prashant_saini", "key": "prashant_saini", "displayName": "Prashant Saini", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Rahman, unfortunately my Moto G4 Play device has not got Android N update yet & main issue is that only this device is firing callback multiple times & other Samsung device I mentioned is not firing but Samsung is not also able to auto-focus on nearby scenes as oppose to its own camera app. Its own camera app is working properly & even Ti.Media without overlay is able to auto-focus on Samsung device, but both these issues (overlay + auto-focus) are very frustrating as I cannot find any particular solution other than writing my own Camera module.\r\n\r\nOne important point to note here is that I created a native Android app for taking pictures in same way as Ti.Media does without overlay, & it is working really fine. Even Facebook, WhatsApp, Instagram & any other app on Play Store is taking pictures fine.\r\n\r\nLast point to note that Ti SDK < 6.x doesn't cause this issue, so I am damn sure this is related to Ti SDK 6.x, but still I hope it should not be there in Ti SDK 7 as I know that large no. of experienced developers has faced weird issues in Ti SDK 6.x", "updateAuthor": { "name": "prashant_saini", "key": "prashant_saini", "displayName": "Prashant Saini", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-28T14:46:46.000+0000", "updated": "2017-11-28T14:46:46.000+0000" }, { "id": "431501", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "master: https://github.com/appcelerator/titanium_mobile/pull/9637", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-29T23:41:53.000+0000", "updated": "2017-11-29T23:41:53.000+0000" }, { "id": "432878", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "7_0_X: https://github.com/appcelerator/titanium_mobile/pull/9706", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-08T22:55:00.000+0000", "updated": "2018-01-08T22:55:00.000+0000" }, { "id": "433046", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~prashant_saini], It looks good on our side but, we do not have a moto G4 device. \r\nCan you please check on your Moto G4 device with this SDK : https://www.dropbox.com/s/3xnxy52q66alnca/7.1.0.v20171227103832.zip?dl=0", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-11T20:12:14.000+0000", "updated": "2018-01-11T20:12:14.000+0000" }, { "id": "433133", "author": { "name": "prashant_saini", "key": "prashant_saini", "displayName": "Prashant Saini", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Lokesh, I have tested it on my Moto G4 device & it's working perfect now! Thanks for providing SDK to test it myself :) (y)", "updateAuthor": { "name": "prashant_saini", "key": "prashant_saini", "displayName": "Prashant Saini", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-14T08:26:55.000+0000", "updated": "2018-01-14T08:26:55.000+0000" }, { "id": "433190", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~prashant_saini], Thanks.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-16T15:54:51.000+0000", "updated": "2018-01-16T15:54:51.000+0000" }, { "id": "433199", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed for both master & backport.\r\nWaiting for merge to get enabled.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-16T18:04:57.000+0000", "updated": "2018-01-16T18:04:57.000+0000" }, { "id": "433623", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Master & backport PR merged.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-24T22:25:29.000+0000", "updated": "2018-01-24T22:25:29.000+0000" }, { "id": "433636", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix with SDK 7.1.0.v20180124153334 & 7.0.2.v20180124142857.\r\n\r\nClosing.\r\n\r\nStudio Ver: 5.0.0.201712081732\r\nOS Ver: 10.13.2\r\nXcode Ver: Xcode 9.2\r\nAppc NPM: 4.2.11\r\nAppc CLI: 7.0.1\r\nDaemon Ver: 1.0.1\r\nTi CLI Ver: 5.0.14\r\nAlloy Ver: 1.10.10\r\nNode Ver: 8.9.1\r\nNPM Ver: 5.5.1\r\nJava Ver: 1.8.0_101\r\nDevices: ⇨ samsung SM-G955U1 — Android 7.0\r\n⇨ google Nexus 5 — Android 6.0.1\r\n", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-25T00:14:59.000+0000", "updated": "2018-01-25T00:14:59.000+0000" } ], "maxResults": 12, "total": 12, "startAt": 0 } } }