Working through the docs basic tutorial " Your First Ionic App: Vue" and I just can’t get the camera (inbuilt, notebook PC) to work.
I have tested the camera using a cam program and also in the browser (chrome) using webcamtests and all works fine.
I get no error just the following screen:
I have tried various tweaks to this code (straight from the tutorial) without any luck:
import {
Plugins, CameraResultType, CameraSource, CameraDirection, CameraPhoto
} from "@capacitor/core"
export function usePhotoGallery() {
const { Camera } = Plugins;
const takePhoto = async () => {
const cameraPhoto = await Camera.getPhoto({
// direction: CameraDirection.Rear, // did not help
resultType: CameraResultType.Uri,
source: CameraSource.Camera,
quality: 50
})
}
return {
takePhoto
}
}
Ionic:
Ionic CLI : 6.12.4 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/vue 5.6.0
Capacitor:
Capacitor CLI : 2.4.7
@capacitor/core : 2.4.7
Utility:
cordova-res : 0.15.3
native-run : 1.3.0
System:
NodeJS : v14.3.0 (/usr/local/bin/node)
npm : 7.5.4
OS : Linux 5.11
I thought that the web browser is supposed to ask for permission to use the webcam, but this does not happen in any of the 3 browsers I have tried with the tutorial code (Firefox, Chrome and Falkon). When hitting the webcamtests site however, I was prompted to grant permission on the camera.
I am unsure how to troubleshoot this further, does anyone have any ideas?