Ionic 4 : Callback when the camera is opened

Hello,

I am currently developing a small testing app for school that compares the performances of different hybrid frameworks.

What I’m currently tryng to do is measure the time it takes to open the camera with Ionic 4. Idealy, I would like to have a button that when clicked on, would open the camera, then close it, then open it, then close it again, etc… until i can get a pretty accurate average duration of the camera loading process.

I am using the Camera plugin of Ionic Native, and the camera opens up perfectly with the this.camera.getPicture(options) call. However, the callbacks of this functions are called when the user closes the camera or takes a picture, but not as soon as the camera is opened up. I have tried to look in the documentation of this plugin but I can’t really find a function with a callback that would be called as soon as the camera is opened up. Furthermore, how would I be able to close the camera from the component’s code ?

I have also looked at the CameraPreview plugin, but after installing it, when I call the this.cameraPreview.startCamera(options) function, the error callback is called with the message “Class Not Found” so I gave up after unsuccessfully trying a few solutions I found online.

Thanks for your help!