android webview 中的全屏模式问题 android 6 中的 webview youtube 视频

Problem in full screen mode in android webview youtube video in android 6

android6 怎么了?请帮我解决这个问题。

logcat第一行的************是短link。要查看 link,请单击 here

我试过许多其他 link,但 android 6.

中存在同样的问题

Logcat:

I/chromium: [INFO:CONSOLE(0)] "requestFullscreen() is deprecated on insecure origins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See************* for more details.", source:  (0)
E/eglCodecCommon: glUtilsParamSize: unknow param 0x000085b5
E/eglCodecCommon: glUtilsParamSize: unknow param 0x000085b5
D/EGL_emulation: eglMakeCurrent: 0x9e67de60: ver 2 0 (tinfo 0x996d7240)
E/eglCodecCommon: glUtilsParamSize: unknow param 0x000085b5
W/AwContents: onDetachedFromWindow called when already detached. Ignoring
D/EGL_emulation: eglMakeCurrent: 0x9e67dda0: ver 2 0 (tinfo 0x996d7240)
D/EGL_emulation: eglMakeCurrent: 0x9e67de60: ver 2 0 (tinfo 0x996d7240)
D/EGL_emulation: eglMakeCurrent: 0x9e67dda0: ver 2 0 (tinfo 0x996d7240)
W/ResourceType: No known package when getting value for resource number 0x02040005
W/System.err: android.content.res.Resources$NotFoundException: String resource ID #0x2040005
        at android.content.res.Resources.getText(Resources.java:312)
        at android.content.res.Resources.getString(Resources.java:400)
        at android.content.Context.getString(Context.java:409)
        at org.chromium.content.browser.ContentVideoView.initResources(ContentVideoView.java:186)
        at org.chromium.content.browser.ContentVideoView.<init>(ContentVideoView.java:174)
        at org.chromium.content.browser.ContentVideoView.createContentVideoView(ContentVideoView.java:365)
        at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
W/System.err:     at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:53)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:148)
        at android.app.ActivityThread.main(ActivityThread.java:5417)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
A/chromium: [FATAL:jni_android.cc(249)] Check failed: false. Please include Java exception stack in crash report
A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 9796 (m.di.battlegame)
E/eglCodecCommon: glUtilsParamSize: unknow param 0x000085b5
Process 9796 terminated.

Java代码:

                webView=(WebView)findViewById(R.id.webview);

                webView.setWebChromeClient(new MyCrome(){

                });



                webView.getSettings().setJavaScriptEnabled(true);




                videourl="<html><body>"+description+"<br><iframe width=\"100%\" height=\"90%\" src=\"https://www.youtube.com/embed/"+videoid+"\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"></iframe></body></html>";

                webView.loadData(videourl,"text/html","utf-8");











public class MyCrome extends WebChromeClient {



        private View mCustomView;
        private WebChromeClient.CustomViewCallback mCustomViewCallback;
        protected FrameLayout mFullscreenContainer;
        private int mOriginalOrientation;
        private int mOriginalSystemUiVisibility;

        MyCrome() {}


        public Bitmap getDefaultVideoPoster()
        {
            if (HowtoActivity.this == null) {

                return Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888);
                //return null;
            }
            //return BitmapFactory.decodeResource(HowtoActivity.this.getApplicationContext().getResources(), 2130837573);

            return Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888);
        }

        public void onHideCustomView()
        {



            ((FrameLayout)HowtoActivity.this.getWindow().getDecorView()).removeView(this.mCustomView);
            this.mCustomView = null;
            HowtoActivity.this.getWindow().getDecorView().setSystemUiVisibility(this.mOriginalSystemUiVisibility);
            HowtoActivity.this.setRequestedOrientation(this.mOriginalOrientation);
            this.mCustomViewCallback.onCustomViewHidden();
            this.mCustomViewCallback = null;

        }



        public void onShowCustomView(View paramView, WebChromeClient.CustomViewCallback paramCustomViewCallback)
        {
            if (this.mCustomView != null)
            {
                onHideCustomView();
                return;
            }

            this.mCustomView = paramView;
            mCustomView.setBackgroundColor(Color.BLACK);
            this.mOriginalSystemUiVisibility = HowtoActivity.this.getWindow().getDecorView().getSystemUiVisibility();
            this.mOriginalOrientation = HowtoActivity.this.getRequestedOrientation();
            this.mCustomViewCallback = paramCustomViewCallback;
            ((FrameLayout)HowtoActivity.this.getWindow().getDecorView()).addView(this.mCustomView, new FrameLayout.LayoutParams(-1, -1));
            HowtoActivity.this.getWindow().getDecorView().setSystemUiVisibility(3846);
        }
        }


上面显示了 webview youtube 视频的代码。 我在 android 9 上测试它,android 10 完美运行。但在 android 6 它给我错误或异常显示在上面 logcat

我解决了我的问题。它只发生在模拟器中。