How does Android use WebView to play Network video control play button?
Add in Code
Webview.getsettings (). Setjavascriptenabled (true);//Support JS
Webview.getsettings (). Setpluginsenabled (true);//Set WebView support plugin
Also add android:hardwareaccelerated= "true" hardware acceleration in the application of the manifest configuration file to play the video
How to Play network video in Android WebView
1. Create a new HTML file and edit its contents:
2. WebView set the WebView component to support JavaScript script to load the HTML for true,load.
3, There are many devices developed only sound, no picture, this time in the Androidmanifest.xml Add application application Set hardware rendering to true, in the OnCreate function to enable hardware rendering. That's a little vague.
1. androidmanifest.xml file Set the following properties:
Android:hardwareaccelerated= "true"
2, add in OnCreate:
GetWindow (). Addflags (
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
Do web video only sound no picture, generally this can be solved. Not all models can, there are exceptions, less.
WebView hardware acceleration causes page rendering Flicker
More than 4.0 of the system when we turn on hardware acceleration, WebView renders the page faster, and the drag is smoother. However, a side effect is that when the WebView view is obscured by a block, and then suddenly recovers (for example, by using Slidemenu to slide the webview from the side), the transition period is white and the interface flashes. The solution to this problem is to temporarily close the hardware acceleration of the webview before the transition period, and then open it after the transition period, with the following code:
if (Build.VERSION.SDK_INT >= build.version_codes. Honeycomb) {
Webview.setlayertype (view.layer_type_software, NULL);
}
WebView Play H5 video problem black screen only sound no picture