{ "id": "164393", "key": "TIMOB-24105", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "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": [], "resolution": null, "resolutiondate": null, "created": "2016-11-04T18:07:04.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [], "issuelinks": [], "assignee": null, "updated": "2019-03-10T21:30:12.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "Currently, if we set *showControls : false* for using camera overlay then volume event is not fired.\r\n- http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Media-event-volume \r\n\r\nWe came to know that this is not natively possible without using private api's that will lead to rejected apps.\r\n\r\n- http://stackoverflow.com/a/8284443/5537752\r\n- http://stackoverflow.com/questions/7839914/initiate-image-capture-using-volume-button-avcapturesession\r\n\r\nBut we see WhatsApp and Snapchat allow it.\r\n\r\nSo you can check this library which claims to do it\r\n- https://github.com/jpsim/JPSVolumeButtonHandler\r\n\r\nh6. Test code\r\n{code:title=app.js}\r\nvar win = Ti.UI.createWindow({\r\n\tlayout : \"vertical\"\r\n});\r\nwin.open();\r\n\r\nvar value = 0;\r\nvar button = Ti.UI.createButton({\r\n\ttitle : \"Camera\",\r\n\ttop : 20,\r\n\twidth : 200,\r\n\theight : 200\r\n});\r\n\r\nbutton.addEventListener(\"click\", takePics);\r\n\r\nwin.add(button);\r\n\r\nvar value = 0;\r\n\r\nvar view = Ti.UI.createView();\r\n\r\nvar overlay = Ti.UI.createView({\r\n\r\n\tbottom : 20,\r\n\tbackgroundColor : \"white\",\r\n\twidth : 70,\r\n\theight : 70,\r\n\tborderRadius : 35\r\n\r\n});\r\n\r\nvar done = Ti.UI.createButton({\r\n\r\n\tbottom : 20,\r\n\ttitle : \"Done\",\r\n\tright : 20,\r\n\tbackgroundColor : \"red\",\r\n\twidth : 50,\r\n\theight : 50,\r\n\tborderRadius : 25\r\n\r\n});\r\n\r\n// Create a Label.\r\nvar number = Ti.UI.createButton({\r\n\tcolor : '#000',\r\n\tfont : {\r\n\t\tfontSize : 10\r\n\t},\r\n\r\n});\r\n\r\ndone.addEventListener('click', function() {\r\n\tnumber.setTitle(\"\");\r\n\tvalue = 0;\r\n\tTi.Media.hideCamera();\r\n});\r\n\r\n// Add to the parent view.\r\nview.add(overlay);\r\nview.add(done);\r\noverlay.add(number);\r\n\r\nfunction takePics() {\r\n\t//alert('You were granted permission.');\r\n\tTi.Media.showCamera({\r\n\t\tsuccess : function(e) {\r\n\t\t\tTi.API.info(e.media);\r\n\t\t\tvalue++;\r\n\t\t\tnumber.setTitle(value);\r\n\r\n\t\t},\r\n\t\terror : function(e) {\r\n\t\t\talert(e);\r\n\t\t},\r\n\t\tautohide : false,\r\n\t\toverlay : view,\r\n\t\tsaveToPhotoGallery : true,\r\n\t\tmediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO],\r\n\t\tshowControls : false\r\n\t});\r\n}\r\n\r\nnumber.addEventListener('click', function(e) {\r\n\tTi.Media.takePicture();\r\n});\r\n\r\nvar currentVolume = Ti.Media.getVolume();\r\n\r\nTi.Media.addEventListener('volume', function(e) {\r\n\talert('click on voluum up button');\r\n\t// Compare with old value to check the volume up, take picture afterwards\r\n\tif (e.volume > currentVolume) {\r\n\t\tTi.Media.takePicture();\r\n\t}\r\n\tcurrentVolume = volume;\r\n});\r\n\r\n\r\n{code}\r\n\r\n\r\nThanks.", "attachment": [], "flagged": false, "summary": "iOS: Support using volume buttons with custom camera controls.", "creator": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "subtasks": [], "reporter": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "environment": "Ti SDK 5.5.1.GA\r\niPhone 5s v10.1.1", "comment": { "comments": [], "maxResults": 1, "total": 1, "startAt": 0 } } }