赞
踩
腾讯X5内核WebView的播放HLS视频全屏异常。
WebView初始化中加入以下内容:
- try {
- if (x5WebView.getX5WebViewExtension() != null) {
- Bundle data = new Bundle();
- data.putBoolean("standardFullScreen", false);
- data.putBoolean("supportLiteWnd", false);
- data.putInt("DefaultVideoScreen", 1);
- x5WebView.getX5WebViewExtension().invokeMiscMethod("setVideoParams", data);
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
- // chromium, enable hardware acceleration
- x5WebView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
- } else {
- // older android version, disable hardware acceleration
- x5WebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
- }
Manifest文件里相关activity加入:
android:configChanges="orientation|screenSize|keyboardHidden"
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。