0

Objective: Have a camera icon button where onClick brings up the users camera on their mobile device from a web app.

Problem Statement: Basically, I have a button, in which onClick I want it to trigger the HTML5

  • input type="file" accept="image/*" capture

, as this tag enables me to access a users mobile camera from a web app.

I am using Reactjs if that matters. I am also working off this question How to access a mobile's camera from a web app? .

BUT I want the camera icon button to access the user's camera.

Right now, the input tag renders a 'Choose File' button along with a 'No File Chosen' text, the 'Choose File' button needs to be clicked in order to access the users' camera. How can use my own button, where on click it brings up the users camera?

The image below shows my button beside what the input tag renders. enter image description here

dutterbutter
  • 97
  • 1
  • 10
  • This is a web app, right? Have you tried [this](https://www.npmjs.com/package/react-camera)? – weirdpanda Feb 11 '18 at 02:26
  • @weirdpanda yes, the problem is it seems that it only gives access to the front camera of a mobile device. The package was built for a computer's webcam I guess. – dutterbutter Feb 11 '18 at 02:34

0 Answers0