Hi why Titanium.Media.showCamera show image preview with wrong aspect ratio? how i can set full screen aspect ratio? (same if i change orientation the aspect ration is all wrong)
this is my code index.js:
var currentCamera = Titanium.Media.CAMERA_REAR; function takePicture(){ Titanium.Media.takePicture(); } function switchCamera(){ if(currentCamera == Titanium.Media.CAMERA_REAR){ Titanium.Media.switchCamera(Titanium.Media.CAMERA_FRONT); currentCamera = Titanium.Media.CAMERA_FRONT; }else{ Titanium.Media.switchCamera(Titanium.Media.CAMERA_REAR); currentCamera = Titanium.Media.CAMERA_REAR; } } $.win.addEventListener('focus',function(){ Titanium.Media.showCamera({ success:function(event) { alert(JSON.stringify(event)); Ti.Media.hideCamera(); }, cancel:function() { }, error:function(error) { var a = Titanium.UI.createAlertDialog({title:'Camera'}); if (error.code == Titanium.Media.NO_CAMERA) { a.setMessage('Please run this test on device'); } else { a.setMessage('Unexpected error: ' + error.code); } a.show(); }, overlay:$.overlay, showControls:false, // don't show system controls mediaTypes:Ti.Media.MEDIA_TYPE_PHOTO, autohide:false // tell the system not to auto-hide and we'll do it ourself }); }); $.win.open();and this my view index.xml
<Alloy> <Window id="win" class="container"> </Window> <View id="overlay"> <Button id="changecamera" onClick="switchCamera"/> <Button id="takephoto" onClick="takePicture"/> <Button id="takevideo" /> </View> </Alloy>and this my index.tss
".container": { width:Ti.UI.FILL, height:Ti.UI.FILL, backgroundColor:'black', tintColor:"#FFF" } "#overlay":{ width:Ti.UI.FILL, height:Ti.UI.FILL, backgroundColor:'transparent', } "#changecamera":{ width:Ti.UI.SIZE, height:Ti.UI.SIZE, image:'/images/ico/flipcamera.png', tintColor:'#FFF', top:20, right:30 } "#takephoto":{ width:Ti.UI.SIZE, height:Ti.UI.SIZE, image:'/images/ico/takephoto.png', bottom:50, tintColor:'#FFF', } "#takevideo":{ width:Ti.UI.SIZE, height:Ti.UI.SIZE, image:'/images/ico/video.png', tintColor:'#FFF', bottom:70, right:30, }