android WebView 无法播放视频
PHP中文网
PHP中文网 2017-04-18 09:13:56
0
3
861

项目中需要使用android webview 加载视频。
已经开启activity的硬件加速,已经打开javascript。但是加载视频是始终loading状态。如下图

求解答方案。不要推荐腾讯浏览器内核SDK ^_^

PHP中文网
PHP中文网

认证0级讲师

reply all(3)
迷茫

Used Tencent X5 browser to solve the problem

左手右手慢动作

Add the settings of the following two lines of code to play online videos! Remember to give me the best answer! !

if (Build.VERSION.SDK_INT < 8) {

 webview.getSettings().setPluginsEnabled(true);  

} else {

 webview.getSettings().setPluginState(PluginState.ON);

}

if(Build.VERSION.SDK_INT>= Build.VERSION_CODES.LOLLIPOP) {
webview.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
}

伊谢尔伦

1. Use a browser to check whether there is a problem with the video playback. If there is a problem, it is caused by the video.
2. After the first step is executed, check whether the settings of the webView are complete. The specific code can be referred to upstairs.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!