javaandroidandroid-webviewandroid-6.0-marshmallowwebchromeclient

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


Whats wrong with android 6? Please help me solve this problem.

The ************ in the first line of the logcat is a short link. To see that link click here.

I've tried many other links but same problem exist in 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 code:

                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);
        }
        }


Above show code for webview youtube video. I test it on android 9 and android 10 works perfect. but in android 6 It give me error or exeption show above logcat


Solution

  • I solved my problem. it happen only in emulator.