【问题标题】:Front Camera of Camera Plugin is not working properly in Ionic 3Camera Plugin 的前置摄像头在 Ionic 3 中无法正常工作
【发布时间】:2019-01-27 12:48:07
【问题描述】:

Ionic 3 摄像头访问代码

 takePhoto(flag) {
return new Promise((resolve, reject) => {
  var sourceType: any;
  if (flag == "PHOTOLIBRARY") {
    sourceType = this.camera.PictureSourceType.PHOTOLIBRARY;
  } else {
    sourceType = this.camera.PictureSourceType.CAMERA;
  }
  const options: CameraOptions = {
    quality: 50,
    sourceType: sourceType,
    destinationType: this.camera.DestinationType.DATA_URL,
    encodingType: this.camera.EncodingType.JPEG,
    mediaType: this.camera.MediaType.PICTURE,
    targetWidth: 450,
    targetHeight: 450,
    saveToPhotoAlbum: false,
    correctOrientation: true,
    cameraDirection: this.camera.Direction.FRONT
  };
  this.camera.getPicture(options).then(
    imageData => {
      resolve(imageData);
    })

})

}

**在使用后置摄像头时它可以工作,但是当我们更改 CameraOptions 的 cameraDirection 但仍然打开后置摄像头时**

【问题讨论】:

    标签: angularjs typescript cordova ionic-framework ionic3


    【解决方案1】:

    这是一个已向 Ionic 3 团队报告的错误。到目前为止,还没有办法让前置摄像头 onclick 解决这个问题。 他们在插件的描述中说,

    任何 cameraDirection 值都会生成背面照片。

    作为一种解决方法,您可以作为用户单击屏幕左侧的按钮来翻转相机。

    【讨论】:

      【解决方案2】:

      你可以直接设置 相机方向:1

      【讨论】:

        猜你喜欢
        • 2020-06-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-09-03
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多