Issue
I am new in android and I am displaying a news link in a webview. News link is displaying properly but video in news link is not playing.
Link is :
http://aajtak.intoday.in/livetv.html
My code is:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
web = (WebView) findViewById(R.id.webview01);
web.setWebViewClient(new myWebClient());
web.getSettings().setJavaScriptEnabled(true);
web.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
web.getSettings().setPluginState(PluginState.ON);
web.loadUrl("http://aajtak.intoday.in/karyakram/video/so-sorry-episode-of-10th-august-2016-on-delhi-aam-admi-party-mla-and-rajnath-singh-najeeb-jung-1-882177.html");
}
public class myWebClient extends WebViewClient
{
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// TODO Auto-generated method stub
super.onPageStarted(view, url, favicon);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// TODO Auto-generated method stub
view.loadUrl(url);
return true;
}
}
Solution
To support video in webview, you need to have hardware acceleration turned on, and set a WebChromeClient. For full screen support, implementations of onShowCustomView(View, WebChromeClient.CustomViewCallback) and onHideCustomView() are required.
Used this, but now a days onShowCustomView() is deprecated.
from YouTube Video not playing in WebView - Android
Answered By - Nikhil Borad
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.