[TIMOB-15844] Android: Media: Unable to switch to front camera
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-12-03T17:31:57.000+0000 |
Affected Version/s | Release 3.2.0 |
Fix Version/s | n/a |
Components | Android |
Labels | qe-3.2.0 |
Reporter | Paras Mishra |
Assignee | Sunila |
Created | 2013-11-28T06:52:41.000+0000 |
Updated | 2017-03-28T21:19:52.000+0000 |
Description
Android: Media: Unable to switch to front camera
Issue occurs on SDK: 3.1.3.GA as well.
Steps to reproduce:
1. Run the below app.
var win = Ti.UI.createWindow({
backgroundColor:'white',
layout:'vertical'
});
// create button, register the modified click callback, add button to window
function addButton(title, clickCallback)
{
var button = Ti.UI.createButton({title:title, width:'300', height:'50'});
button.addEventListener('click', function() {
Ti.Media.showCamera({mediaType:Ti.Media.MEDIA_TYPE_PHOTO});
clickCallback();
Ti.Media.vibrate();
});
win.add(button);
}
// camera with no switch
addButton('Default Camera', function(){
});
// camera with front specified
addButton('Front Camera Test 1', function(){
Ti.Media.switchCamera(Ti.Media.CAMERA_FRONT);
});
// camera with front specified after switching to back
// checks if switch function actually works, opposed to it being the default
addButton('Front Camera Test 2', function(){
Ti.Media.switchCamera(Ti.Media.CAMERA_REAR);
Ti.Media.switchCamera(Ti.Media.CAMERA_FRONT);
});
// camera with back specified
addButton('Back Camera Test 1', function(){
Ti.Media.switchCamera(Ti.Media.CAMERA_REAR);
});
// camera with back specified after switching to front
// checks if switch function actually works, opposed to it being the default
addButton('Back Camera Test 2', function(){
Ti.Media.switchCamera(Ti.Media.CAMERA_FRONT);
Ti.Media.switchCamera(Ti.Media.CAMERA_REAR);
});
// camera passed invalid (non-existent) argument
addButton('Invalid Camera', function(){
Ti.Media.switchCamera(undefined);
});
win.open();
2. Click 'Front Camera Test 1'
Expected:
Front Camera should be open.
Actual:
Unable to switch, front camera is opened.
Logs occurs as "
[ERROR] : TiMedia: (KrollRuntimeThread) [14139,14139] Camera preview is not open, unable to switch camera.
[ERROR] : TiMedia: (KrollRuntimeThread) [1,14140] Camera preview is not open, unable to switch camera.
[WARN] : IInputConnectionWrapper: showStatusIcon on inactive InputConnection
[WARN] : IInputConnectionWrapper: showStatusIcon on inactive InputConnection
[ERROR] : TiMedia: (KrollRuntimeThread) [13464,27604] Camera preview is not open, unable to switch camera.
[WARN] : IInputConnectionWrapper: showStatusIcon on inactive InputConnection
"
actually switching is working if you add an overlay with a button and switch after the camera is open. But you can't start directly with the front facing camera. Verified on Nexus 4 (3.2 Beta)
Camera can be switched only with custom overlay. With custom overlay, one can set 'whichCamera' option in the 'showCamera' options to set the default type.
Closing ticket as invalid.