-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
I'm using web view to display youtube with full screen in android , and i try doing research and find
this link . After I try code , but show out the error message
Cannot convert object to Landroid/webkit/WebChromeClient; at index 0
javascript
var page;
exports.onNavigatingTo = function (args) {
page = args.object;
var webview = page.getViewById("webview");
webview.src = "";
}
exports.onWebViewLoaded = function (webargs) {
var page = webargs.object.page;
var webview = webargs.object;
var myWebChromeClient = android.webkit.WebChromeClient.extend({
onShowFileChooser: function () {
alert("Test");
return true;
}
});
webview.android.setWebChromeClient(myWebChromeClient);
}
XML
<Page
xmlns="http://schemas.nativescript.org/tns.xsd" actionBarHidden="true" navigatingTo="onNavigatingTo">
<GridLayout rows="auto, *" columns="*" class="background-color">
<GridLayout height="50" class="header-mainblue" columns="50, * , 50">
<Button text="" tap="onGoBack" class="btn-mainblue fa" />
<Label text="Tutorial" horizontalAlignment="center" verticalAlignment="center" color="#ffffff" class="h3" paddingTop="5" col="1" textWrap="true"/>
</GridLayout>
<GridLayout rows="*" columns="*" row="1">
<WebView id="webview" loaded="onWebViewLoaded" />
</GridLayout>
</GridLayout>
</Page>