Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PWA mobile camera access

Tags:

My requirement is to access the mobile camera in iOS and android using the mobile browser.

Using Ionic PWA app can I access mobile camera in iOS and android device browsers? Looking for PWA solution using Cordova (not native solution).

like image 369
jinu S Avatar asked Jul 06 '17 15:07

jinu S


People also ask

Can PWA use phone camera?

I went through many blogs and tutorials for this and I found few things are not working with IOS while Android has good support for PWA. Let's see them one by one. Can PWA access camera? Yes, both the OS gives access to the camera, which allows image and video capturing in PWA.

Can PWAs access camera?

Progressive web apps can also access device features, like the camera, GPS, contact book, and calendar. When a user launches a PWA, it doesn't launch the web browser. Instead, the app takes up the user's whole screen, which makes them look and feel like standalone apps.

Can a PWA access phone contacts?

There are some restrictions that cannot be overcome with a PWA: - you cannot access the contacts list on a phone. - On the other hand, you can take photos and use GPS location.


1 Answers

While working on a PWA. I came across the need to access a mobile device's camera/images.(a native app was out of the question). After doing some research I came across this little nugget.

<input type="file" accept="image/*" capture="camera" /> 

By adding the accept and capture attributes I was able to access my phone's camera and images. I should also point out that you don't need to do anything special with your Server side (Node or PHP). It acts just like a standard file upload input in a browser.

like image 192
Gokul Avatar answered Oct 04 '22 14:10

Gokul