When set on a file input type, operating systems with microphones and cameras will display a user interface allowing the selection from an existing file or the creating of a new one.
When capture is enabled, Android will present an Intent chooser:
Known limitation: video and audio intents are not currently supported, but this solves the primary use case.
Addresses: https://github.com/hotwired/turbo-android/issues/139
Given the following markup, turbo-android already handles opening a file chooser to upload files:
However, it's not currently possible change the file
Intent
to capture an image from the camera. Android'sWebChromeClient
[handles thecapture
attribute](https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#isCaptureEnabled()):This PR adds the following behavior:
When
capture
is enabled, Android will present anIntent
chooser:Known limitation: video and audio intents are not currently supported, but this solves the primary use case.