Make Ionic Native Camera Plugin only take pictures from FRONT camera

387 views Asked by At

My current options for taking photos from an iPad camera in my Ionic/Cordova application are as follows:

const options: CameraOptions = {
        quality: 70,
        destinationType: this.camera.DestinationType.DATA_URL,
        encodingType: this.camera.EncodingType.JPEG,
        mediaType: this.camera.MediaType.PICTURE,
        correctOrientation: true,
        cameraDirection: this.camera.Direction.FRONT
    };

I read on the Cordova documentation that setting the property cameraDirection tells which camera you want to use when you take a picture on a device using your app. I set the direction to front, hoping this would mean that only front facing pictures would be accepted. Unfortunately, I am still able to switch to my back camera once the camera app is opened.

Is there a way to limit the camera to only being used by the front facing camera?

1

There are 1 answers

0
andreszs On

Short answer: Not with Cordova, because the Camera plugin uses a native camera from the device that always includes the rotation button. You can however create a custom camera plugin (in Java) to get rid of all buttons but this requires plenty of Java knowledge.