android - Android WebView播放视频报错闪黑屏
问题描述
嗨,我正在从 webview 编写应用程序,当在 webview 中播放视频时,有时会出现错误,并且手机屏幕开始闪烁白黑。
看录屏https://youtu.be/ST8fc0w_Um8
并在日志 android studio
2020-07-30 11:14:51.575 32584-310/ru.example E/chromium: [ERROR:image_reader_gl_owner.cc(263)] no buffers currently available in the reader queue
2020-07-30 11:14:51.613 32584-310/ru.example E/chromium: [ERROR:shared_image_factory.cc(471)] CreateSharedImage: could not create backing.
2020-07-30 11:14:51.614 32584-310/ru.example E/chromium: [ERROR:shared_image_stub.cc(169)] SharedImageStub: Unable to create shared image
2020-07-30 11:14:51.624 32584-32643/ru.example E/chromium: [ERROR:shared_image_manager.cc(141)] SharedImageManager::ProduceGLTexture: Trying to produce a representation from a non-existent mailbox. 48:86:2E:E3:73:35:1E:70:B4:F7:83:AD:17:E1:CE:8F
2020-07-30 11:14:51.624 32584-32643/ru.example E/chromium: [ERROR:gles2_cmd_decoder.cc(18937)] [GroupMarkerNotSet(crbug.com/242999)!:B89A0D1A74000000]GL ERROR :GL_INVALID_OPERATION : DoCreateAndTexStorage2DSharedImageINTERNAL: invalid mailbox name
2020-07-30 11:14:51.624 32584-32643/ru.example E/chromium: [ERROR:gles2_cmd_decoder.cc(18958)] [GroupMarkerNotSet(crbug.com/242999)!:B89A0D1A74000000]GL ERROR :GL_INVALID_OPERATION : DoBeginSharedImageAccessCHROMIUM: bound texture is not a shared image
2020-07-30 11:14:51.624 32584-32643/ru.example E/chromium: [ERROR:gles2_cmd_decoder.cc(18987)] [GroupMarkerNotSet(crbug.com/242999)!:B89A0D1A74000000]GL ERROR :GL_INVALID_OPERATION : DoEndSharedImageAccessCHROMIUM: bound texture is not a shared image
2020-07-30 11:14:51.624 32584-32643/ru.example E/chromium: [ERROR:gles2_cmd_decoder.cc(18958)] [GroupMarkerNotSet(crbug.com/242999)!:B89A0D1A74000000]GL ERROR :GL_INVALID_OPERATION : DoBeginSharedImageAccessCHROMIUM: bound texture is not a shared image
2020-07-30 11:14:51.625 32584-32643/ru.example E/chromium: [ERROR:gles2_cmd_decoder.cc(10716)] [GroupMarkerNotSet(crbug.com/242999)!:B89A0D1A74000000]RENDER WARNING: texture bound to texture unit 0 is not renderable. It might be non-power-of-2 or have incompatible texture filtering (maybe)?
2020-07-30 11:14:51.626 32584-32643/ru.example E/chromium: [ERROR:gles2_cmd_decoder.cc(18987)] [GroupMarkerNotSet(crbug.com/242999)!:B89A0D1A74000000]GL ERROR :GL_INVALID_OPERATION : DoEndSharedImageAccessCHROMIUM: bound texture is not a shared image
2020-07-30 11:14:51.712 32584-310/ru.example E/chromium: [ERROR:shared_image_factory.cc(471)] CreateSharedImage: could not create backing.
2020-07-30 11:14:51.712 32584-310/ru.example E/chromium: [ERROR:shared_image_stub.cc(169)] SharedImageStub: Unable to create shared image
2020-07-30 11:14:51.729 32584-32643/ru.example E/chromium: [ERROR:shared_image_manager.cc(141)] SharedImageManager::ProduceGLTexture: Trying to produce a representation from a non-existent mailbox. 7E:1A:65:59:81:24:B8:07:83:A5:48:04:2B:51:A5:59
我的网页浏览设置
View rootView = inflater.inflate(R.layout.fragment, container, false);
WebView = (ObservableWebView) rootView.findViewById(R.id.WebView);
WebView.setVerticalScrollBarEnabled(false);
WebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET);
WebView.setFocusable(true);
WebView.setFocusableInTouchMode(true);
WebView.getSettings().setJavaScriptEnabled(true);
WebView.getSettings().setDomStorageEnabled(true);
WebView.getSettings().setAppCacheEnabled(true);
WebView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
WebView.getSettings().setAllowFileAccessFromFileURLs(true);
WebView.getSettings().setAllowUniversalAccessFromFileURLs(true);
WebView.getSettings().setPluginState(WebSettings.PluginState.ON_DEMAND);
WebView.getSettings().setMediaPlaybackRequiresUserGesture(false);
///WebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
//WebView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
WebView.setWebChromeClient(new WebChromeClient());
WebView.setWebViewClient(new WebViewClient(){
@Override
public void onPageFinished(android.webkit.WebView view, String url) {
if(appBarHeight==0){
appBarHeight=((MainActivity) getContext()).getHeightPanel();
}
super.onPageFinished(view, url);
}
});
WebView.addJavascriptInterface(new JavascriptBridge(WebView), "Android");
请帮助解决这个问题
解决方案
推荐阅读
- javascript - 常用表达
- influxdb - 我是否可以只返回前 10 个系列而不是所有系列
- javascript - 在世博会打开相机
- cakephp-3.0 - cake php where条件返回所有值
- c++ - VCLinkerTool.GenerateDebugInformation 属性不支持 DEBUG:FULL 和 DEBUG:FASTLINK
- bash - 在比较和变量赋值中出错
- scala - 下面的理解如何工作?
- javascript - 在 Javascript 中引用对象的层次结构
- typescript - 您可以添加功能、修改或扩展打字稿吗?
- sql - 一些棘手的问题