Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: input capture="camera" doesn't open camera #916

Closed
Aarbel opened this issue Feb 10, 2020 · 7 comments
Closed

Bug: input capture="camera" doesn't open camera #916

Aarbel opened this issue Feb 10, 2020 · 7 comments

Comments

@Aarbel
Copy link

Aarbel commented Feb 10, 2020

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

When clicking on this input, it doesn't open the camera of android device, it opens files browser instead.

Didn't found a way to fix it properly with all i read on stackoverflow and github.

Anyone has a simple solution ?

@Aarbel
Copy link
Author

Aarbel commented Feb 10, 2020

cf apache/cordova-plugin-camera#489 and #816 which are not exactly about camera capture, but default displayed browser, so different issues.

@breautek
Copy link
Contributor

A workaround would be to use the cordova-plugin-camera APIs, although with this route, you'd probably want to build your own custom button instead of using the browser's <input> tag.

I believe this doesn't work because most of the input file attribute the native app actually needs to intercept and handle it explicitly. It's not "automatic" like the chrome browser. This could be a feature request, but there are some hurdles to jump through. Namely the requirement for apps to declare what features they use, including if they use the camera feature, which is something that the cordova-plugin-camera already does... and adding that into the core library is not really feasible imo.

@WuglyakBolgoink
Copy link

@Aarbel found solution?

@Aarbel
Copy link
Author

Aarbel commented Nov 23, 2020

@WuglyakBolgoink yes i use the navigator.mediaDevices.getUserMedia API. It's not perfect, but it makes the job if you parse the medias, and select the one with "rear' and "back" in their names to get the device back camera.(in more details: navigator.mediaDevices API has an "environment" preference setting to select the back camera, but doesn't work well to select the right rear camera on all the devices (for example Microsoft Surface Devices), so it's necessary to list de media Devices and select the right ones you want.

@shailen-naidoo
Copy link

Did anyone find a solution for this yet?

@qiutian00
Copy link

maybe use cordova-plugin-camera plugin

@Aarbel
Copy link
Author

Aarbel commented May 14, 2024

Looks like we have little enhancement here: #1609

@Aarbel Aarbel closed this as completed May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants