I recently implemented this specific plugin in my project which allows me to easily capture images using my Android device.
However, I'm encountering some difficulties when trying to display the images that are captured within my app. After attempting a certain method, an error message was displayed: "TypeError: Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob'."
function takePicture(){
navigator.device.capture.captureImage(
img=>{
convertToBase64(img).then(b64=>{
document.getElementById('fsPhotoI').src=b64;
}).catch(e=>alert(e));
},
err=>{alert(err);},
{limit:1}
);
}
function convertToBase64(image) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(image);
reader.onload = () => resolve(reader.result);
reader.onerror = error => reject(error);
});
}