I am currently learning Ionic 4, and for an academic project, we have to develop a mobile app for iOS and Android.
The development of our project was going prefectly fine, and we used the ionic serve -l
to run our app. We find that the Ionic Lab is really practical to develop, as we can have a mobile preview of our app inside the browser, for android as well as for iOS. We also really like the “live” aspect of the ionic serve
command, as we don’t have to restart the server at every change in the code.
However, as I now have to implement an audio recorder in the app, I tried the follow the documentation of Ionic available here. I added the cordova-plugin-media-capture plugin with the following command ionic cordova plugin add cordova-plugin-media-capture
, and installed the media-capture package with the following command npm install @ionic-native/media-capture
.
It seems like it’s working fine, but when I click on a button to try to record some audio, it doesn’t work, and I get the following warning and error the Chrome console :
Native: tried calling MediaCapture.captureImage, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator
cordova_not_available
I’ve searched for solutions online, and it seems like in order to use cordova plug-ins such as the media capture, it is needed to run the application with a command like ionic cordova run browser
. And it seems like it’s working, however I get the “browser” version of my app.
So my question is fairly simple : is there any way I can get the cordova media capture plug-in to work in the Ionic Lab ? If not, is there any other app-testing envrionment that are similar to the Ionic Lab (a mobile platform preview, fast launch, live testing…) that allows this plug-in to work ?
I’m sorry if this is a dumb question, as me and my team are still learning Ionic for school, and thus are quite new to this whole envrionment.
Thanks in advance for your answers.