简体   繁体   中英

Make Ionic Native Camera Plugin only take pictures from FRONT camera

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM