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

Enable image capture for file uploads #141

Merged
merged 11 commits into from
Feb 3, 2021
Merged

Enable image capture for file uploads #141

merged 11 commits into from
Feb 3, 2021

Conversation

jayohms
Copy link
Collaborator

@jayohms jayohms commented Feb 2, 2021

Addresses: #139

Given the following markup, turbo-android already handles opening a file chooser to upload files:

<input type="file" id="file" accept="*/*" />

However, it's not currently possible change the file Intent to capture an image from the camera. Android's WebChromeClient handles the capture attribute:

<input type="file" id="photo" accept="image/*" capture="user" />

This PR adds the following behavior:

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:

2021-02-02 17 16 18

Known limitation: video and audio intents are not currently supported, but this solves the primary use case.

@jayohms jayohms marked this pull request as ready for review February 3, 2021 18:15
Copy link
Contributor

@lateplate lateplate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants