Using Capacitor and PWA-Elements, we are clicking photo on mobile device as per the following code
if (!Capacitor.isPluginAvailable('Camera')) {
this.fileinput.nativeElement.click();
return;
}
else {
const image = await Plugins.Camera.getPhoto({
quality: 20,
allowEditing: false,
direction: CameraDirection.Rear,
correctOrientation: true,
resultType: CameraResultType.Base64,
source: CameraSource.Camera
}).then((image) => {
this.imgBase64List.push(image.base64String);
this.imgBase64ListDisplay.push("data:image/jpeg;base64," + image.base64String);
// localStorage.setItem(this.TsList.TSNo+ "GpInImageBase64", JSON.stringify(this.imgBase64List));
this.storeImage();
}).catch((error) => {
this.showToast(error)
});
/* this.imgBase64List.push(image.base64String);
this.imgBase64ListDisplay.push("data:image/jpeg;base64," + image.base64String);
// localStorage.setItem(this.TsList.TSNo+ "GpInImageBase64", JSON.stringify(this.imgBase64List));
this.storeImage(); */
}
While Camera Direction is always rear but it always open up front camera in PWA where as it works perfect as native app(apk)