嗨,我正在搜索过去两天解决此问题的方法,但仍然没有得到任何解决方案。webview
我正在播放YouTube视频,当我单击它时,视频工作正常,但是如果我单击Full Screen
图标,应用程序会崩溃并出现以下错误。我尝试在WebCromeClient
中覆盖onShowCustomeView
,但它不起作用。我尝试了WebView和HTML5<视频>线程中的所有解决方案。该解决方案适用于安卓手机,我在 Lg g2 和 xperia p 和 nexus 7 上对其进行了测试,但在诺基亚 x 上它仍然崩溃。有什么方法可以阻止视频全屏播放或完全播放。视频>
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
看看这个
重写该方法以返回非空视图对象(例如,布局中的虚假0x0视图),并查看是否仍然崩溃
@Override
public View getVideoLoadingProgressView() {
FrameLayout frameLayout = new FrameLayout(getSherlockActivity());
frameLayout.setLayoutParams(new LayoutParams( LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT));
return frameLayout;
}