I have a problem, I cannot play video in webview by html5 here, my code
webView = (WebView) findViewById(R.id.web);//new WebView(this); webView.setBackgroundColor(android.R.color.transparent); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setPluginsEnabled(true); webView.getSettings().setAllowFileAccess(true); webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR); webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS); webView.loadUrl("file:///android_asset/index.html");
and here is mycode html
<html lang="en"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <video autoplay="autoplay" controls="controls" style="align:center;" autobuffer onclick="this.play();"> <source src="birtday2527.theora.ogv" type="video/ogg" codecs="theora, vorbis"/> <source src="birtday2527.mp4" type="video/mp4"/> </video> </body>
I have a link to the test.
source share