I am trying to embed youtube video in my android app using WebView. Here is the code:
{
WebView mView = new WebView(getContext());
String embeded = loadPlayer(); // this is javascript string containing YtPlayer api
WebSettings webSettings = mPreview.getSettings();
webSettings.setJavaScriptEnabled(true);
mView.setBackgroundColor(535353);
WebChromeClient mChromeClient = new WebChromeClient();
mView.setWebChromeClient(mChromeClient);
mView.setWebViewClient(new WebViewClient());
mView.loadDataWithBaseURL("http://www.youtube.com", embeded, "text/html", "utf-8", null);
}
The problem I am having is my video gets clipped somewhere in the middle and the touch events on video don't work. Here is the link to screenshot:
Any ideas on what I am doing wrong here.
P.S. - This happens only on ICS 4.0.3 and it works fine on JellyBean 4.1
Any help is greatly appreciated.