switch camera

You must Login before you can answer or comment on any questions.

hi.. Ti.Media.swichCamera is not working in titanium for android. I need to switch between the two cameras and take photos.Has anyone solved this issue?

— asked 8 months ago by roopa raman
2 Comments
  • can you describe more with some code in which you are facing issue.

    — commented 8 months ago by Ashutosh Chaturvedi

  • if (Ti.Media.camera = Ti.Media.CAMERA_REAR) { Ti.Media.switchCamera(Ti.Media.CAMERA_FRONT);

    this line does not work and i get an error saying switchCamera is not an object of Media.

    — commented 8 months ago by roopa raman

1 Answer

are you sure the function is supported on android? did you do a clean build before running your app?

I would add this function to make sure that it is recognizing the rear camera

var cameras = Ti.Media.availableCameras;
    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)
        {
                      alert(Ti.Media.CAMERA_REAR);
        } else if (cameras[c]==Ti.Media.CAMERA_FRONT ) {
                      alert(Ti.Media.CAMERA_FRONT);
                }
    }

— answered 8 months ago by Aaron Saunders
answer permalink
1 Comment
  • No i think its not supported switchCamera , availableCameras is still not supported .is there any ways to switch camera in android.

    — commented 8 months ago by roopa raman

Your Answer

Think you can help? Login to answer this question!