5

Hi I am searching the workaround for this problem from past two days but still I have not get any solution. In webview I am playing YouTube video the video works fine when I click on it but if I click on Full Screen icon the app crash with the below errors. I tried overriding onShowCustomeView in WebCromeClient but it does not works. I tried all solutions from WebView and HTML5 <video> thread.The solutions works for android phone I tested it on Lg g2 and xperia p and nexus 7 but on nokia x it still crash. Is there any way I can stop video from playing full screen or playing at all.

04-03 10:12:50.769 E/AndroidRuntime( 3867): java.lang.NullPointerException

    04-03 10:12:50.769 E/AndroidRuntime( 3867):     at android.view.ViewGroup.addViewInner(ViewGroup.java:3384)

    04-03 10:12:50.769 E/AndroidRuntime( 3867):     at android.view.ViewGroup.addView(ViewGroup.java:3256)

    04-03 10:12:50.769 E/AndroidRuntime( 3867):     at android.view.ViewGroup.addView(ViewGroup.java:3232)

    04-03 10:12:50.769 E/AndroidRuntime( 3867):     at android.webkit.HTML5VideoFullscreen.enterFullscreen(HTML5VideoFullscreen.java:253)

    04-03 10:12:50.769 E/AndroidRuntime( 3867):     at android.webkit.HTML5VideoView.enterFullscreenVideoState(HTML5VideoView.java:535)

    04-03 10:12:50.769 E/AndroidRuntime( 3867):     at android.webkit.HTML5VideoViewProxy$VideoPlayer.enterFullscreenVideo(HTML5VideoViewProxy.java:183)

    04-03 10:12:50.769 E/AndroidRuntime( 3867):     at android.webkit.HTML5VideoViewProxy.handleMessage(HTML5VideoViewProxy.java:476)

    04-03 10:12:50.769 E/AndroidRuntime( 3867):     at android.os.Handler.dispatchMessage(Handler.java:99)

    04-03 10:12:50.769 E/AndroidRuntime( 3867):     at android.os.Looper.loop(Looper.java:137)

    04-03 10:12:50.769 E/AndroidRuntime( 3867):     at android.app.ActivityThread.main(ActivityThread.java:4807)

    04-03 10:12:50.769 E/AndroidRuntime( 3867):     at java.lang.reflect.Method.invokeNative(Native Method)

    04-03 10:12:50.769 E/AndroidRuntime( 3867):     at java.lang.reflect.Method.invoke(Method.java:511)

    04-03 10:12:50.769 E/AndroidRuntime( 3867):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)

    04-03 10:12:50.769 E/AndroidRuntime( 3867):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:559)

    04-03 10:12:50.769 E/AndroidRuntime( 3867):     at dalvik.system.NativeStart.main(Native Method)

    04-03 10:12:50.769 I/ActivityManager(  571): Notify an ApplicationCrash
Community
  • 1
  • 1
Sunny
  • 14,522
  • 15
  • 84
  • 129
  • http://developer.android.com/reference/android/webkit/WebChromeClient.html#getVideoLoadingProgressView%28%29 – Sree Apr 04 '14 at 06:11
  • how this helps to stop video to enter full screen? – Sunny Apr 04 '14 at 06:15
  • overriding that method to return a non-null View object (for instance, a bogus 0x0 View in your layout) and see if you still crash.we can try to stop video from enter full screen if it crash again – Sree Apr 04 '14 at 06:16
  • 1
    @Sreekanthss You are absolutely genius. Just work on nokia x thank you so much!! I override the method as `@Override public View getVideoLoadingProgressView() { FrameLayout frameLayout = new FrameLayout(getSherlockActivity()); frameLayout.setLayoutParams(new LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); return frameLayout; }` Now video plays in full screen with out any problem. – Sunny Apr 04 '14 at 06:52
  • Please post this as a answer. – Sunny Apr 04 '14 at 06:53
  • my pleasure to hear that it worked for you , i am posting this as a answer , some one other will need this – Sree Apr 04 '14 at 06:57

1 Answers1

3

Look this

overriding that method to return a non-null View object (for instance, a bogus 0x0 View in your layout) and see if you still crash

         @Override
         public View getVideoLoadingProgressView() { 
           FrameLayout frameLayout = new FrameLayout(getSherlockActivity());    
           frameLayout.setLayoutParams(new LayoutParams( LayoutParams.MATCH_PARENT,    
          LayoutParams.MATCH_PARENT));
           return frameLayout;
         }
Sree
  • 3,136
  • 2
  • 31
  • 39