I loaded the embedded youtube url into webview.But if i press play button its not perfoming any action but if i press somewhere other than play button the youtube video is getting played.Please some one help me.Thanks in advance.
HomeFragment.class:
public class HomeFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
// TODO Auto-generated method stub
View rootView = inflater.inflate(R.layout.activity_main1, container,
false);
WebView webview=(WebView)rootView.findViewById(R.id.webView1);
webview.loadUrl("https://www.youtube.com/embed/DXLnBMZM09g");
webview.getSettings().setJavaScriptEnabled(true);
webview.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
@Override
public void onPageStarted(WebView view, String url,
Bitmap favicon) {
super.onPageStarted(view, url, favicon);
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
}
});
return rootView;
}
}
activity_main1:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:hardwareAccelerated="true" >
<WebView
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:layout_weight="1" />