[TIMOB-27138] Android: Add photo/video capture support to WebView
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-11-25T15:26:21.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 9.3.0 |
Components | Android |
Labels | andoid, media, parity, webView |
Reporter | Nikos Poulios |
Assignee | Joshua Quick |
Created | 2019-06-06T13:11:40.000+0000 |
Updated | 2020-11-25T15:26:21.000+0000 |
Description
*Summary:*
Android's
Ti.UI.WebView
does not currently support "capturing" a photo or video when using one of the below input HTML elements. It will display a photo gallery selection activity window instead.
* <input type="file" accept="image/*" capture="environment"/>
* <input type="file" accept="video/*" capture="environment"/>
*To-Do:*
When configuring our Intent
in [TiWebChromeClient.java](https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/src/java/ti/modules/titanium/ui/widget/webview/TiWebChromeClient.java), we need to set it to [MediaStore.ACTION_IMAGE_CAPTURE](https://developer.android.com/reference/android/provider/MediaStore#ACTION_IMAGE_CAPTURE) for photo capture support and [MediaStore.ACTION_VIDEO_CAPTURE](https://developer.android.com/reference/android/provider/MediaStore#ACTION_VIDEO_CAPTURE) for video capture support. We also need to show a CAMERA permission request dialog as well.
*Note:*
We can only add support for Android 5.0 and higher.
Attachments
File | Date | Size |
---|---|---|
WebViewCaptureImageTest.js | 2020-09-19T02:49:57.000+0000 | 1005 |
WebViewCaptureVideoTest.js | 2020-09-19T02:49:57.000+0000 | 1195 |
PR (master): https://github.com/appcelerator/titanium_mobile/pull/12105
FR passed for this part of the PR
*Closing ticket*. Fix verified in SDK version
9.3.0.v20201125050632
. Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/12105