Camera is not found in ionic Cordova

Viewed 71

i am facing a camera plugin issue, unable to access camera.On click on camera button we are getting "camera is not found".

id="cordova-plugin-camera" version="6.0.0"

$scope.addImage = function () {
 logsFctry.logsDisplay('DEBUG', $scope.TagName, "Entered into addImage");
            var options = {
                destinationType: Camera.DestinationType.FILE_URI,              
                sourceType:Camera.PictureSourceType,
                //CAMERA,Camera.PictureSourceType.PHOTOLIBRARY, 
                mediaType: Camera.MediaType.PICTURE,
                allowEdit: false,
                encodingType: Camera.EncodingType.JPEG,
                popoverOptions: CameraPopoverOptions,
                cameraDirection: Camera.Direction.BACK,
                // saveToPhotoAlbum: true,
                quality: 80,
                targetWidth: 800,
                targetHeight: 800,
                correctOrientation: true
            };
   }
1 Answers

In option you are passing wrong parameter for sourceType. It should be like Camera.PictureSourceType.CAMERA. Or you can use this option

  var options = {
        quality: 50, // It can be 100, 200 etc
        targetHeight: 500,
        targetWidth: 375,
        sourceType: Camera.PictureSourceType.CAMERA
        encodingType: Camera.EncodingType.JPEG,
        mediaType: Camera.MediaType.PICTURE,
        allowEdit: false,
        correctOrientation: true,
        destinationType: Camera.DestinationType.FILE_URI,
    }

This will return you file_uri.

Related