You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.
I'm using nativescript vue and loading a website in the app using nativescript-webview-ext. In the loaded website I have a file input field that suppose to open the camera (works on regular browser and iOS but doesn't on Android).
After doing some research, I realized that I need to extend the WebChromeClient and do something on the onShowFileChooser event to manually replicate the file input response.
To do this, in my Vue file (where the webview is loaded), I load the website like this:
And then in the onWebViewLoaded I try doing this:
let myWebChromeClientClass = androidVm.webkit.WebChromeClient.extend({
onShowFileChooser: function (WebView, ValueCallback, FileChooserParams) {
// FileChooserParams.createIntent()
camera.takePicture() // Using nativescript-camera
.then(function (imageAsset) {
console.log("Result is an image asset instance");
var image = new Image();
image.src = imageAsset;
console.log(image)
}).catch(function (err) {
console.log("Error -> " + err.message);
});
return false
}
});
let myWebChromeClient = new myWebChromeClientClass();
webView.android.setWebChromeClient(myWebChromeClient);
Currently, I'm struggling to make the nativescript-camera behave after taking the picture (always returns 'canceled') but I know there is a way to show the native file input selection using FileChooserParams but I can't make this work either.
Does anyone else tried this and have any tips on how can I make this work? The end goal is to take a picture and return ir to the file input field that is in the webview.
Thanks in advance.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Which platform(s) does your issue occur on?
Please, provide the following version numbers that your issue occurs with:
I'm using nativescript vue and loading a website in the app using nativescript-webview-ext. In the loaded website I have a file input field that suppose to open the camera (works on regular browser and iOS but doesn't on Android).
After doing some research, I realized that I need to extend the WebChromeClient and do something on the onShowFileChooser event to manually replicate the file input response.
To do this, in my Vue file (where the webview is loaded), I load the website like this:
And then in the onWebViewLoaded I try doing this:
let myWebChromeClientClass = androidVm.webkit.WebChromeClient.extend({
Currently, I'm struggling to make the nativescript-camera behave after taking the picture (always returns 'canceled') but I know there is a way to show the native file input selection using FileChooserParams but I can't make this work either.
Does anyone else tried this and have any tips on how can I make this work? The end goal is to take a picture and return ir to the file input field that is in the webview.
Thanks in advance.
The text was updated successfully, but these errors were encountered: