[TIMOB-15812] Android: Media: Camera is not opening with overlay property set in Ti.Media.showCamera()
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-01-07T00:12:03.000+0000 |
Affected Version/s | Release 3.2.0 |
Fix Version/s | Release 4.0.0 |
Components | Android |
Labels | qe-3.2.0 |
Reporter | Paras Mishra |
Assignee | Ashraf Abu |
Created | 2013-11-25T12:40:07.000+0000 |
Updated | 2015-02-12T03:00:00.000+0000 |
Description
Android: Media: Camera is not opening with overlay property set in Ti.Media.showCamera().
It also occur on SDK: 3.1.3.GA
Steps to reproduce
1. Run the below app.
var _window = Ti.UI.createWindow({
backgroundColor:'white'
});
var openCameraButton = Ti.UI.createButton({
title : 'Open Camera'
});
openCameraButton.addEventListener('click', function(e) {
var cameraOverlay = Ti.UI.createView();
var takePhotoButton = Ti.UI.createButton({
backgroundColor : '#fff',
backgroundSelectedColor : '#efefef',
borderColor : '#000',
borderRadius : 17,
borderWidth : 1,
bottom : 65,
color : '#000',
height : 34,
opacity : 0.4,
title : 'Take Photo',
width : '100dp'
});
var closeCameraButton = Ti.UI.createButton({
backgroundColor : '#fff',
backgroundSelectedColor : '#efefef',
borderColor : '#000',
borderRadius : 17,
borderWidth : 1,
bottom : 65,
color : '#000',
height : 34,
opacity : 0.4,
right : 10,
title : 'Close Camera',
top : 10,
width : '150dp'
});
takePhotoButton.addEventListener('click', function(e) {
Ti.Media.takePicture();
});
closeCameraButton.addEventListener('click', function(e) {
alert('closing camera');
Ti.Media.hideCamera();
});
cameraOverlay.add(takePhotoButton);
cameraOverlay.add(closeCameraButton);
Ti.Media.showCamera({
success : function(e) {
alert('success callback');
},
cancel : function() {
Ti.API.info('cancel callback');
},
error : function(e) {
Ti.API.info('error callback');
},
allowEditing : false,
animated : false,
autohide : false,
mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO],
overlay : cameraOverlay,
saveToPhotoGallery : false,
showControls : false
});
});
_window.add(openCameraButton);
_window.open();
if overlay property is commented then the app works fine.
Expected:
Camera is opened.
Actual:
Camera does not open.
Is this specific to device or Android version? It is working in my Galaxy Nexus running Android 4.3
The issue cannot reproduce with the release master 3.2.0 Tested with: Titanium Studio, build: 2.1.2.201208301612 Titanium SDK version: 3.2.0 Tested on Device: Samsung galaxy s duos Android version: 4.0.4
Issue still reproducible on following environment: Appcelerator Studio, build: 3.2.1.201401151647 SDK build: 3.2.1.v20140117222448 acs@1.0.11 alloy@1.3.1-beta2 npm@1.3.2 titanium@3.2.1 titanium-code-processor@1.1.0 Mac9(Maverick) Devices: Nexus 7(4.3) Camera is not opening with overlay property while this is working fine on iOS.
Issue was for devices like Nexus 7 (2012), code was trying to use rear facing camera which doesn't exists when overlay is being used. PR: https://github.com/appcelerator/titanium_mobile/pull/6536
Verified fix on: Mac OSX 10.10.2 Appcelerator Studio, build: 4.0.0.201502051633 Titanium SDK build: 4.0.0.v20150211081857 Titanium CLI, build: 3.6.0-dev Alloy: 1.5.1 Android build tools 21.1.1 Nexus 7 (4.3) Built to device, the camera now opens and uses the front camera. Closing ticket.