Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9845] Android: Camera with overlay does not auto focus

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-12-19T00:25:06.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sRelease 3.1.0, 2012 Sprint 26 API, 2012 Sprint 26
ComponentsAndroid
LabelsSupportTeam, api, insight, module_media, qe-closed-3.3.0, qe-testadded
ReporterJosh Roesslein
AssigneePing Wang
Created2012-06-29T12:34:27.000+0000
Updated2016-04-28T19:17:29.000+0000

Description

When showing a camera with a custom overlay it will not auto focus even if the hardware supports it. This probably just requires us calling Camera.autoFocus() when we start preview.

Test case

Run the Camera overlay example in KS. Try aiming at some text at closely and at far to see if the focus adjusts to make the text clear.

Comments

  1. Ping Wang 2012-12-12

    Test case:
       var overlay = Ti.UI.createView();
       var button = Titanium.UI.createButton({
       	color : '#fff',
       	bottom : 10,
       	width : 301,
       	height : 57,
       	font : {
       		fontSize : 20,
       		fontWeight : 'bold',
       		fontFamily : 'Helvetica Neue'
       	},
       	title : 'Take Picture'
       });
       
       button.addEventListener('click', function() {
       	Ti.Media.takePicture();
       });
       
       overlay.add(button);
       
       Titanium.Media.showCamera({
       
       	success : function(event) {
       		Ti.API.debug("********************************* Picture was taken");
       
       	},
       	cancel : function() {
       	},
       	error : function(error) {
       		Ti.API.debug("********************************** Error in showing camera: " + error.message);
       	},
       	overlay : overlay,
       	mediaTypes : Ti.Media.MEDIA_TYPE_PHOTO,
       	saveToPhotoGallery : true
       }); 
       
    For FR: 1. Run the above test case on 2.2, 2.3, 3.x and 4.x devices. 2. Try aiming at some text at closely and click the button "Take Picture". Should see the focus adjusts to make the text clear when the picture is captured. 3. Run the test case on 4.x device. Try aiming at some text at closely and at far to see the focus continuously adjusts to make the text clear (*DON'T* click the button "Take Picture").
  2. Ping Wang 2012-12-12

    PR: https://github.com/appcelerator/titanium_mobile/pull/3578
  3. Priya Agarwal 2014-07-01

    Verified with: Appcelerator-Studio:3.3.0.201406271159 Sdk:3.3.0.v20140627202512 acs:1.0.14 alloy:1.4.0-rc3 npm:1.3.2 titanium:3.3.0-rc4 titanium-code-processor:1.1.1 xcode:5.1.1 OS:Maverick(10.9.3) Device:iPhone5c(v7.1.1),LG-P970(v4.0.4) camera auto focus working fine. Hence closing the issue.
  4. Tim Poulsen 2016-04-28

    I realize this is an old ticket, but I am experiencing this issue with all of the Ti 5.x SDKs (currently using 5.2.0.GA). The camera is stuck focusing on a close distance and never focuses on anything in the distance. Taking the photo does not cause the camera to lock into proper focus and we get a blurry photo. (While we are an enterprise customer, I can't log into Jira with my enterprise account. So, I'm using my community/Titan account to post this comment.)
  5. Tim Poulsen 2016-04-28

    Sorry, I'm seeing this problem on iOS, not Android. I missed the platform in the title.

JSON Source