Application error while playing YouTube video in view mode

I developed an application in which I upload my YouTube channel to webview and it works just fine as expected. I can play videos on a small screen, as well as in full screen.

But the problem is that I put the application in the background while the video plays in full screen and causes the foreground application to crash. I saw the crash log, but it shows nothing from my code. I don’t understand what is the cause of the accident. It shows a NullPointerException, but where it came is a mystery.

Logcat : 08-09 14:21:33.480: E/AndroidRuntime(10157): FATAL EXCEPTION: main 08-09 14:21:33.480: E/AndroidRuntime(10157): java.lang.NullPointerException 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.webkit.HTML5VideoFullScreen.prepareForFullScreen(HTML5VideoFullScreen.java:187) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.webkit.HTML5VideoFullScreen.access$600(HTML5VideoFullScreen.java:24) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.webkit.HTML5VideoFullScreen$2.surfaceCreated(HTML5VideoFullScreen.java:124) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.SurfaceView.updateWindow(SurfaceView.java:609) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:235) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.View.dispatchWindowVisibilityChanged(View.java:7678) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1335) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1112) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4472) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.Choreographer.doCallbacks(Choreographer.java:555) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.Choreographer.doFrame(Choreographer.java:525) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.os.Handler.handleCallback(Handler.java:615) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.os.Handler.dispatchMessage(Handler.java:92) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.os.Looper.loop(Looper.java:137) 08-09 14:21:33.480: E/AndroidRuntime(10157): at android.app.ActivityThread.main(ActivityThread.java:4898) 08-09 14:21:33.480: E/AndroidRuntime(10157): at java.lang.reflect.Method.invokeNative(Native Method) 08-09 14:21:33.480: E/AndroidRuntime(10157): at java.lang.reflect.Method.invoke(Method.java:511) 08-09 14:21:33.480: E/AndroidRuntime(10157): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006) 08-09 14:21:33.480: E/AndroidRuntime(10157): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773) 08-09 14:21:33.480: E/AndroidRuntime(10157): at dalvik.system.NativeStart.main(Native Method) 

The application does not crash if I place the application in the background while the video is playing only on a small screen.

+4
source share

Source: https://habr.com/ru/post/1496223/


All Articles