One of the feature requests in the mobile web-app I’m building, is a Take Photo button. The app is paired with an in-real-world physical feature the general public can interact with, hence the prompt for the user to take a photo of what they accomplished.
I’m not wanting to capture this photo in any way. I’m just hoping it’s possible to launch the users native camera app when they hit the Take Photo button.
In HTML5, something like it can apparently be achieved with this:
I’ve yet to fully test this on mobile devices, but to trigger the element I wanted above, using the solution @Confidant linked to, was actually quite simple.
In the generated index.html, within the <body> I included:
This is effectively invisible to the user, but a “click” event to that element can now be initiated within Haxe. In the class this function is needed, I import the js.Browser.document package:
import js.Browser.document;
Then, I generate a click event for that input element, referencing the id I gave it (take-photo):
document.querySelector("#take-photo").click();
So that could be fired based on an in-Haxe button click, or some other event.