How to automatically use front camera

Hello guys,

I wanna use only front camera, i used -> cordova plugin add cordova-plugin-camera

When i change value of cameraDirection to 1 or Camera.Direction.BACK both not working.

Any sugestion guys to solve that problem ?

Here is the code :

$scope.takeCamera = function(){

	var optionsCamera = {
	  quality: 50,
	  destinationType: Camera.DestinationType.DATA_URL,
	  targetWidth: 50,
	  cameraDirection : 1,
	  encodingType : Camera.EncodingType.JPEG
	var onAfterCaptureCamera = function(imageData){
		alert('berhasil');{}, function(){});
	var onFailCamera = function(message){
	};, onFailCamera, optionsCamera);

1 Like

What’s not working? Have you looked at a console.log?

when i run takeCamera function, camera work well but always show back camera. Then click change change camera.

What i wanted is when i run takeCamera function, show front camera at the first time

Hi @mjs,

Any leads on this. I am also not able to get it working for android.

Hi @Aster!

Had the same issue month ago…

After several trys with no luck and a lot of reading i found this oneliner in the cordova docs under the Android quirks section:

Any cameraDirection value results in a back-facing photo.

Here is the link:

I also found the related issue for frontfacing Camera Option resolved with a “wont fix” here:

The author also mentioned that it is possible for the User to toggle the Camera direction. I think this is not the case. Will try it on latest Android tomorrow…

Let me know in you can find the toggle option. :grinning:

The toggle Option is (as expected) not there…

Is there any body that can make front facing camera working on android??

I can’t believe that such standard functionality is not working for such a long time?!?!?

Are there other plugins where i can use the front facing camera?


1 Like

Any solutions yet , guys?
I want to open the camera from the start for selfie

Won’t cameraDirection: solve it? going to check now

Worked for me…
I am firing the camera from constructor

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Camera, CameraOptions } from '@ionic-native/camera';

  selector: 'page-home',
  templateUrl: 'home.html'
export class HomePage {
  public base64Image: string;

  constructor(public navCtrl: NavController,private camera: Camera) {
  takePhoto(sourceType:number) {
    const options: CameraOptions = {
      quality: 50,
      correctOrientation: true,
    } => {
      let base64Image = 'data:image/jpeg;base64,' + imageData;
    }, (err) => {
      // Handle error


Don’t forget camera at app.module.ts

providers: [
    {provide: ErrorHandler, useClass: IonicErrorHandler},

On what device you tested?

not working back camera only opened