I have an app that takes pictures with the method: Ti.Media.takePicture ();
when the camera is launched with a button I can change the front camera and take the picture with this code:
var = Ti.Media.availableCameras cameras;
for (var c = 0; c <cameras.length; c ++) { // If we have a rear camera ... we add switch button if (cameras [c] == Ti.Media.CAMERA_REAR) { overlay.add (btnConfiguracion); overlay.add (btnCompartir); overlay.add (cameraType); //cameraType.addEventListener ('load', function () { cameraType.addEventListener ('click', function () { // When switching from camera stop and restart counters if (inicioConteo == "yes") { inicioConteo = "NO"; clearInterval (conteoTomarFotoFijo); segundosContadorFijo = 7; conteoRegresivoFijo (); }
if (== Ti.Media.camera Ti.Media.CAMERA_FRONT) { //cameraType.title = "front"; Ti.Media.camera = Ti.Media.CAMERA_REAR; Ti.Media.switchCamera (Ti.Media.CAMERA_REAR); } Else { //cameraType.title = "rear"; Ti.Media.camera = Ti.Media.CAMERA_FRONT; Ti.Media.switchCamera (Ti.Media.CAMERA_FRONT); } });
but when you start the camera again looks back camera again, you can set if you have front camera always start this