Hi,
As usual I need your suggestion on implementing camera feature on my PWA (Ionic 2). I added the below cordova plugins and the platform. But I am unable to access the camera. Can some one help me out with Ionic 2 coding
npm install @ionic-native/camera --save
ionic cordova plugin add cordova-plugin-camera
ionic cordova platform add browser
ionic cordova build browser --prod
It’s generating the browser build in the following folder
<>/platforms/browser/www
But when I access it using my mobile browser I am unable to access the camera.
Thanks in advance!
regards,
Mano
Hi,
The native camera plugin won’t work for PWA as that is to support the Cordova camera plugin.
However you’re in luck, I made an example that allows you to access the camera using the input type=“file” variant. Works on Android / iOS / browser.
1 Like
Hi Judgewest,
Thanks for your quick reply with a solution. I will check your example.
I am just wondering that the doc says that using ionic native wrapper class we can use the cordova camera plugin
In the supported platform they have mentioned Browser as well.
regards,
Mano
If you get it to work. Let me know.
Please someone tell me if this is wrong - it’s not well researched: The wrapper wraps the cordova plugin which only works in the native setting. When you try it with a browser it will gracefully fail but that’s it.