I am trying to play html5 video and youtube video within android webview, but can\'t display video on android webview screen. and play this video.
I have used below
you haven't added mCustomViewContainer to your view hierarchy
It worked for me. May help you as well play html videos
I used html5webview to solve this problem.Download and put it into your project then you can code just like this.
private HTML5WebView mWebView;
String url = "SOMEURL";
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mWebView = new HTML5WebView(this);
if (savedInstanceState != null) {
mWebView.restoreState(savedInstanceState);
} else {
mWebView.loadUrl(url);
}
setContentView(mWebView.getLayout());
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mWebView.saveState(outState);
}
To make the video rotatable, put android:configChanges="orientation" code into your Activity for example (Androidmanifest.xml)
<activity android:name=".ui.HTML5Activity" android:configChanges="orientation"/>
and override the onConfigurationChanged method.
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
if you are running it on tablet... you add hardwareaccelerated= true in your manifest file and it will certainly work.. also change the sdk version to 11