0

正规365体育投注hello i'm using ionic 4 and i want to take picture that's why i use cordova plugin camera and i get this error when i click to the button for take picture

this my code:

import { NavController } from 'ionic-angular';
import { Camera, CameraOptions } from '@ionic-native/camera/ngx';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
capturedSnapURL:string;

cameraOptions: CameraOptions = {
  quality: 20,
  destinationType: this.camera.DestinationType.DATA_URL,
  encodingType: this.camera.EncodingType.JPEG,
  mediaType: this.camera.MediaType.PICTURE
}
constructor(public navCtrl: NavController,private camera: Camera) {}

takeSnap() {
  this.camera.getPicture(this.cameraOptions).then((imageData) => {
    // this.camera.DestinationType.FILE_URI gives file URI saved in local
    // this.camera.DestinationType.DATA_URL gives base64 URI

    let base64Image = 'data:image/jpeg;base64,' + imageData;
    this.capturedSnapURL = base64Image;
  }, (err) => {

    console.log(err);
    // Handle error
  });
} ```
| improve this question | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.