Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-19597

Android: Add previewRect (height, width) to camera callback

    Details

    • Story Points:
      5
    • Sprint:
      2015 Sprint 22 SDK

      Description

      When custom camera overlay is used add the size of the preview image on Android devices inside the camera callback

       
      var self = Ti.UI.createWindow();
          var cameraOverlay = Titanium.UI.createView({
          	backgroundColor: '#FF00FFAA'
          });
        
          var cameraOverlayButton = Titanium.UI.createImageView({
              bottom: 100,
              image: '/appcelerator_small.png',
          });
          cameraOverlay.add(cameraOverlayButton);
        
          cameraOverlay.addEventListener('click', function(e){
          	Ti.API.info("taking pic");
              Ti.Media.takePicture();
          });
        
          self.addEventListener("postlayout", postlayoutHandler);
          function postlayoutHandler(e) {
              self.removeEventListener("postlayout", postlayoutHandler);
              Titanium.Media.showCamera({
                  overlay: cameraOverlay,
                  showControls: false,
                  success: function(e) {
                        Ti.API.info('# SUCCESS : '+ JSON.stringify(e));
                  },
                  cancel: function(e) {
                        Ti.API.info('# CANCEL : '+e.error);
                     
                  },
                  error: function(e) {
                        Ti.API.info('# ERROR : '+ e.code +' : '+ e.error);
                     
                  },
                  mediaTypes:Ti.Media.MEDIA_TYPE_PHOTO,
              });
          }
          self.open();
      

      in order to position overlays correctly again.

      Related ticket: https://jira.appcelerator.org/browse/TC-5105
      Solution: http://androblip.huiges.nl/2010/07/25/camera-preview-size-picture-size-and-scaling/

        Attachments

          Activity

            People

            • Assignee:
              ssombhatla Srikanth Sombhatla (Inactive)
              Reporter:
              michael Michael Gangolf
              Reviewer:
              Ashraf Abu (Inactive)
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-20407
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code