ionic 4 cordova-plugin-camera默认的FRONT相机无法在android上使用

问题描述 投票:0回答:1

**我正在使用这个CameraOptions **

private optionsCamera: CameraOptions = {
quality: 50,
saveToPhotoAlbum: false,
correctOrientation:true,
allowEdit: true,
targetWidth:1024,
targetHeight:1024,
sourceType: this.camera.PictureSourceType.CAMERA,
cameraDirection: this.camera.Direction.FRONT, // also i use Numbers also "1"
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.PNG,
mediaType: this.camera.MediaType.PICTURE,

}

但是在构建后,android仅打开后置摄像头

**请为我提供替代相机插件(默认前置相机)或为ionic 4修复此错误**

android ionic-framework cordova-plugins ionic4 cordova-plugin-camera
1个回答
0
投票

定义选项,然后在构造函数或方法中使用它:

private const optionsCamera: CameraOptions = {
    cameraDirection: 1
}

然后从构造函数或您想在任何地方动态设置值的方法:

this.optionsCamera.cameraDirection = this.camera.Direction.FRONT;
© www.soinside.com 2019 - 2024. All rights reserved.