Sathish
Sathish

Reputation: 69

Phonegap/Cordova - Front-facing camera by default in Android

I tried the solution at Android Front Facing Camera by default, but still it is using the back-facing camera. Can someone please provide the full code to get the front-facing camera?

Upvotes: 1

Views: 3024

Answers (2)

Bryant Makes Programs
Bryant Makes Programs

Reputation: 1694

This code will flip the camera on older devices and ios devices, but will not change the default facing on newer android versions.

navigator.camera.getPicture(onPhotoDataSuccess, onFail, { 
    quality: 50, 
    cameraDirection:1, 
    destinationType: destinationType.DATA_URL}); 
}

Upvotes: 0

user3145832
user3145832

Reputation: 13

cameraDirection property is used to set the camera direction(front/back). You have to add it in the options like this:

navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50, cameraDirection:1, destinationType:        destinationType.DATA_URL}); } 

"1" is used for front-facing camera and "2" is used for back-facing camera.

Upvotes: 1

Related Questions