查了一下资料,文档上写着支持视频播放的条件:
In order to support inline HTML5 video in your application,
you need to have ha
《Android学习笔记总结+最新移动架构视频+大厂安卓面试真题+项目实战源码讲义》
【docs.qq.com/doc/DSkNLaERkbnFoS0ZF】 完整内容开源分享
rdware acceleration turned on, and set a WebChromeClient.
For full screen support,
implementations of onShowCustomView(View, WebChromeClient.CustomViewCallback)
and onHideCustomView() are required, getVideoLoadingProgressView() is optional.
意思就是:
1、要打开硬件加速
2、设置 WebChromeClient ,并实现 onShowCustomView() 方法和onHideCustomView()方法。
3、要支持全屏
接下来就是解决问题:
1、首先开启硬件加速
在AndroidMainfest.xml中,当前webView所在类的标签中添加 : android:hardwareAccelerated=“true”
2、设置 WebChromeClient
我们添加一个内部类,实现 WebChromeClient, 并复写其中的方法
private class MyWebChromeClient extends W