Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27742] Android: Minor camera focus issues

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2020-04-09T14:29:16.000+0000
Affected Version/sn/a
Fix Version/sRelease 9.0.1
ComponentsAndroid
Labelsn/a
ReporterGary Mathews
AssigneeGary Mathews
Created2020-01-28T18:51:38.000+0000
Updated2020-06-18T11:46:39.000+0000

Description

- Camera should not crash with E/TiExceptionHandler: (main) [55,37938] autoFocus failed - Camera should continue to auto focus after taking a picture *TEST CASE*
const overlay = Ti.UI.createView({});
const takePicture = Ti.UI.createButton({ title: 'Take Picture' });

takePicture.addEventListener('click', _ => {
    Ti.Media.takePicture();
});
overlay.add(takePicture);

Ti.Media.requestCameraPermissions(e => {
    if (e.success) {
        Ti.Media.showCamera({
            success: e => {
                if (e.success) {
                    console.log('Taken picture successfully!');
                } else {
                    console.error(JSON.stringify(e, null, 2));
                }
            },
            saveToPhotoGallery: true,
            autohide: false,
            overlay: overlay,
            mediaTypes: [ Ti.Media.MEDIA_TYPE_PHOTO ]
        });
    }
});

Comments

  1. Gary Mathews 2020-01-28

    master: https://github.com/appcelerator/titanium_mobile/pull/11454
  2. Gary Mathews 2020-03-24

    9_0_X: https://github.com/appcelerator/titanium_mobile/pull/11562
  3. Samir Mohammed 2020-04-09

    *Closing ticket.* Fix verified in SDK version 9.1.0.v20200406120646. and 9.0.1.v20200408050151. Tested using:
       const overlay = Ti.UI.createView({});
       const takePicture = Ti.UI.createButton({ title: 'Take Picture' });
       
       takePicture.addEventListener('click', _ => {
           Ti.Media.takePicture();
       });
       overlay.add(takePicture);
       
       function showCamera(e) {
           Ti.Media.showCamera({
               success: e => {
                   if (e.success) {
                       console.log('Taken picture successfully!');
                   } else {
                       console.error(JSON.stringify(e, null, 2));
                   }
               },
               saveToPhotoGallery: true,
               autohide: false,
               overlay: overlay,
               mediaTypes: [ Ti.Media.MEDIA_TYPE_PHOTO ]
           });
       }
       
       if (Ti.Media.hasCameraPermissions()) {
           showCamera();
       } else {
           Ti.Media.requestCameraPermissions(e => {
               if (e.success) {
                   showCamera();
               }
           });
       }
       
       
    Test and other information can be found at: master: https://github.com/appcelerator/titanium_mobile/pull/11454 9_0_X: https://github.com/appcelerator/titanium_mobile/pull/11562

JSON Source