Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8151] Android: camera image is stretched when using an overlay

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-07-05T15:08:39.000+0000
Affected Version/sRelease 1.7.6, Release 2.0.0, Release 1.8.2
Fix Version/sSprint 2012-14 API, Release 3.0.0
ComponentsAndroid
LabelsSupportTeam, api, module_media, qe-manualtest, qe-port
ReporterFederico Casali
AssigneeJosh Roesslein
Created2012-03-21T09:57:34.000+0000
Updated2014-08-08T20:45:55.000+0000

Description

Problem description

Camera view is stretched and badly displayed when using overlays

Steps to reproduce

Code sample taken from bug TIMOB-4745
Ti.UI.setBackgroundColor('#ffffff');

var homeWindow =	Titanium.UI.createWindow
({

});
homeWindow.open();

var displayVoucherOverlayView 	= 	Ti.UI.createView
({
	top:		0,
	bottom:		0,
	left:		0,
	right:		0,
	opacity:	0.75
});
var setAButton	=	Ti.UI.createButton
({
	top:		100,
	left:		30,
	right:		30,
	height:		75,
	title:		"HELLO"
});
displayVoucherOverlayView.add(setAButton);

setAButton.addEventListener('click', function() { alert("I HAVE BEEN PRESSED");} );

var navigationBar = 	Ti.UI.createView
({
	bottom: 			0,
	height: 			50,
	right:				0,
	backgroundColor: 	"#000000",
	opacity:			0.75
});
var navBarTestBtn 	= 	Ti.UI.createView
({
	left:				5,
	width: 				90,
	height: 			50,
	top: 				0,
	backgroundColor: 	"#000000",
	borderColor: 		"#FFFFFF",
	borderWidth: 		2
});
var navBarTestBtnText 	= 	Ti.UI.createLabel
({
	width: 				90,
	text: 				"TEST",
	color: 				"#FFFFFF",
	textAlign: 			'center',
	font: 				{fontSize: 		10}
});
navBarTestBtn.add(navBarTestBtnText);
navigationBar.add(navBarTestBtn);

navBarTestBtn.addEventListener('click',   function() {alert("IM A VIEW WITH A LISTENER");} );

displayVoucherOverlayView.add(navigationBar);

var cameraTransform 	= 	Ti.UI.create2DMatrix();
cameraTransform 		= 	cameraTransform.scale(2);

Ti.Media.showCamera
({
    success:			function(event) {},
    cancel:				function() {},
    error:				function(error) 
	{
        if (error.code == Ti.Media.NO_CAMERA) 
		{
			alert("NO CAMERA");
        } 
		else 
		{
			alert("CAMERA ERROR");
        }
    },
	mediaTypes:			[Ti.Media.MEDIA_TYPE_VIDEO,Ti.Media.MEDIA_TYPE_PHOTO],
    showControls:		false,
    autohide:			false,
    transform:			cameraTransform,
    overlay:			displayVoucherOverlayView
});
Camera image appears stretched and blurry. Image taken looks fine.

Additional info

IND ticket associated: http://support-admin.appcelerator.com/display/APP-344639

Comments

  1. Josh Roesslein 2012-04-26

    Sent [PR #2081](https://github.com/appcelerator/titanium_mobile/pull/2081) to address the issue. Disable a bit of code which was overriding the camera preview size resulting in the poor quality image preview.
  2. Tamila Smolich 2012-06-23

    Tested on: Titanium Studio, build: 2.1.0.201206221045 Titanium SDK: 2.1.0.v20120622174154 Device: Samsung Galaxy tab (3.2) Camera view is still stretched.
  3. Josh Roesslein 2012-07-03

    Created [PR #2507](https://github.com/appcelerator/titanium_mobile/pull/2507) to resolve issue.
  4. Bill Dawson 2012-07-05

    tested on HTC Desire (2.2) HTC Sensation (2.3) Asus Transformer TF101 (3.1) Motorola Xoom (4.0.3) Samsung Galaxy Nexus (4.1)
  5. Rima Umbrasas 2012-08-10

    Verified fixed with mobile sdk-2.2.0.v20120810080115 Titanium Studio, build: 2.1.1.201207271312 Device: Galaxy S III Android version 4.0.4

JSON Source