Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React, open mobile camera on web

Tags:

reactjs

I have a React web app and I want that the user click a button an open the camera if it's in mobile device, in order to select pictures from the gallery or take photos directly with the camera. With React Native is quit easy, but I need to do it in web, with browers.

I have test the npm library https://www.npmjs.com/package/react-webcam but that library display the webcam in the web, I want to open the mobile interface, any idea?

like image 212
pmiranda Avatar asked Oct 18 '25 02:10

pmiranda


1 Answers

You cannot access native android libraries with reactJS(that's why we use React-Native or Android SDK), someone is still to create a library for this.

You can always ask the user to upload an image instead.

Code: https://codesandbox.io/s/elated-shannon-5yg9x?file=/src/index.js

like image 150
Anmol Bhardwaj Avatar answered Oct 19 '25 17:10

Anmol Bhardwaj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!