In webView, I am loading a html file. The file contains text, images and a youtube link. Text and the images are displayed just by loadUrl() method, but video is not being played. How should I get the link and play video.
Format in which link is present in html file is :
<p style="text-align: center; margin: 0px;">
<iframe class="youtube-player" type="text/html" width="300" height="169" src="http://www.youtube.com/embed/4H0fTwtPLfo" allowfullscreen frameborder="0">
</iframe>
</p>
Please guide me.
EDIT
loading html file:
webView.loadUrl("file:///android_asset/"+htmlFile);
webView.setWebViewClient(new VideoWebViewClient());
VideoWebViewClient class:
private class VideoWebViewClient extends WebViewClient{
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String url) {
webView.loadUrl(url);
return true;
}
}
EDIT 2
I am able to play video by adding following lines of code:
WebSettings webSetting = webView.getSettings();
webSetting.setJavaScriptEnabled(true);
webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND);
webSetting.setAllowContentAccess(true);
webView.loadUrl("file:///android_asset/"+htmlFile);
webView.setWebViewClient(new VideoWebViewClient());
I want to play video in full screen, but the full screen button freeze the video. Can anyone help?