{ "id": "61864", "key": "TIMOB-1232", "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": "11224", "name": "Release 1.4.0", "archived": true, "released": true, "releaseDate": "2010-07-16" } ], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2011-04-15T02:47:16.000+0000", "created": "2011-04-15T02:47:16.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "ios", "iphone" ], "versions": [], "issuelinks": [], "assignee": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-02T19:23:10.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}
see attached example. toggle flash to on, take picture and app\nfreezes
\n\n\n// this sets the background color of the master UIView (when there are no windows/tab groups on it)\nTitanium.UI.setBackgroundColor('FFF');\n\n// create tab group\nvar tabGroup = Titanium.UI.createTabGroup();\n\n//\n// create base UI tab and root window\n//\nvar win1 = Titanium.UI.createWindow({ \n title:'Camera Flash Test',\n backgroundColor:'#fff'\n});\nvar tab1 = Titanium.UI.createTab({ \n icon:'KS_nav_views.png',\n title:'Camera',\n window:win1\n});\n\nfunction isiOS4Plus()\n{\n // add iphone specific tests\n if (Titanium.Platform.name == 'iPhone OS')\n {\n var version = Titanium.Platform.version.split(\".\");\n var major = parseInt(version[0], 10);\n\n // can only test this support on a 3.2+ device\n if (major >= 4)\n {\n return true;\n }\n }\n return false;\n}\n\nvar cameraButton = Ti.UI.createButton({\n title:'Camera Test',\n height:40,\n width: 280,\n left:20,\n top:300\n});\ncameraButton.addEventListener('click', function () {\n\n if (isiOS4Plus())\n {\n Ti.Media.cameraFlashMode = Ti.Media.CAMERA_FLASH_OFF;\n }\n \n var overlayView = Ti.UI.createView({\n height:480,\n width:320,\n backgroundColor:'transparent'\n });\n\n var cameraFlash = Titanium.UI.createButton({\n title:'Flash: Off',\n height:30,\n width:100,\n left:20,\n top:20,\n borderRadius:8\n });\n cameraFlash.addEventListener('click', function() {\n\n if (!isiOS4Plus())\n {\n return;\n }\n \n if (Ti.Media.cameraFlashMode == Ti.Media.CAMERA_FLASH_ON)\n {\n cameraFlash.title = \"Flash: Off\";\n Ti.Media.cameraFlashMode = Ti.Media.CAMERA_FLASH_OFF;\n }\n else\n {\n cameraFlash.title = \"Flash: On\";\n Ti.Media.cameraFlashMode = Ti.Media.CAMERA_FLASH_ON;\n }\n });\n \n var button1 = Titanium.UI.createButton({\n title:'Shoot',\n height:40,\n width:100,\n left:110,\n top:5\n });\n button1.addEventListener('click', function() {\n Ti.Media.takePicture();\n });\n\n var button2 = Titanium.UI.createButton({\n title:'Done',\n height:40,\n width:100,\n left:5,\n top:5\n });\n button2.addEventListener('click', function() {\n Ti.Media.hideCamera();\n });\n \n var background = Ti.UI.createView({\n height:50,\n width:320,\n backgroundColor:'black',\n bottom:0\n }); \n\n background.add(button1);\n background.add(button2);\n\n overlayView.add(background);\n overlayView.add(cameraFlash);\n\n Titanium.Media.showCamera({\n \n success:function(event)\n { \n },\n \n cancel:function()\n {\n },\n error:function(error)\n {\n },\n showControls:false,\n allowImageEditing:false,\n autohide:false,\n mediaTypes:Ti.Media.MEDIA_TYPE_PHOTO,\n overlay:overlayView,\n saveToPhotoGallery:true\n });\n});\n\n\nwin1.add(cameraButton);\n\ntabGroup.addTab(tab1); \n\n// open tab group\ntabGroup.open();
\n
this is an invalid test. see KS camera_overlay.js or\ncamera_overlay_webview.js for examples
\nsince you are calling takePicture, you'll have to either (a) set\nautohide:true or (b) call Ti.Media.hideCamera().
\nwhen you don't have the flash on, the interface won't show the\ncamera flash indicator (the swirley looking image) - however, when\nyou have a flash, it will. To cause the interface to close, you'll\nhave to call hideCamera.
\nI've verified this with a standalone XCode project outside of\nTitanium.
\nI'm not sure if this is a bug or not in 4.0. It seems like the\nonly way to do continuous pictures is to ensure that the flash is\noff so it doesn't show the flash view.