How can I know in Android
WebView
that video is clicked?
For example: When I run Facebook in web view and in it when I click on video Toast come and tell me that video is clicked.
How can I know in Android
WebView
that video is clicked?
For example: When I run Facebook in web view and in it when I click on video Toast come and tell me that video is clicked.
You can add JavascriptInterface
to WebView
and capture the click by VideoObjectID
on your HTML
page.
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.addJavascriptInterface(new Object() {
public void performClick() {
// Deal with a click on the WebView's Video Object ID
}
}, "video_object_id");
You HTML
must have something similar to below:
<div type="video_object_id" onclick="performClick();">Play Video</div>