How can I open camera on mobile phone on a web app?
Taking a look at https://developers.google.com/web/fundamentals/media/capturing-images/ you can find a warning as follows:
So no. The only way to 'solve' your problem is to use HTTPS.
Open mobile camera by clicking a button through web browser
With an input[type="file"]
field you can pick a file, or ask the device to record a media. It will always open an app or a prompt to choose an app. If you want to stay in the browser you need to use the MediaStream Recording API but it is not fully supported yet. For now, it is not working in iOS so either way, you have to open up the default camera app.
If you want to take photos you can try the MediaStream Image Capture API. But it is still just an experimental technology which won't work in most of the current browsers.
You can find some examples here:
- Taking still photos with WebRTC - MDN
- ImageCapture.takePhoto - MDN
- Take Photos and Control Camera Settings - Google developers
- Access the camera interactively - Google developers
I hope the links above can help you
How to access camera on iOS11 home screen web app?
We have quite similar problem. So far the only workaround we were able to do is to remove the meta tag for it to be "apple-mobile-web-app-capable" and let users to open it in Safari, where everything seems to work normally.
Access mobile camera from HTML/Angular application
You should be able to select between the front and rear camera using the capture attribute.
For the rear camera:
<input type="file" accept="image/*" capture="environment">
For the front camera, you should be able to use: capture="user"
or just capture.
You can read a bit more about it here if you'd like: https://developers.google.com/web/fundamentals/media/capturing-images/
Related Topics
Pure CSS Multi-Level Drop-Down Menu
In Indexeddb, How to Make a Sorted Compound Query
Is Type="Text/Css" Necessary in a ≪Link≫ Tag
How to Center Nav-Items in Bootstrap
Using :Before and :After CSS Selector to Insert HTML
Difference Between Iframe, Embed and Object Elements
How to Vertically Center Text in a Dynamically Height Div
How to Show Split Header in the Material Table Having Nested Group of Data in Angular
Absolute Positioning Inside Absolute Position
Colspan/Rowspan For Elements Whose Display Is Set to Table-Cell
Using CSS :Before and :After Pseudo-Elements With Inline Css
Apply CSS Styles to an Element Depending on Its Child Elements
Difference Between ≪Input Type='Submit' /≫ and ≪Button Type='Submit'≫Text≪/Button≫
How to Draw a Trapezium/Trapezoid with CSS3
<Fieldset> Resizes Wrong; Appears to Have Unremovable 'Min-Width: Min-Content'