Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在模拟器上全屏播放视频时报错 #32

Closed
KennyLeung opened this issue Aug 29, 2021 · 11 comments
Closed

在模拟器上全屏播放视频时报错 #32

KennyLeung opened this issue Aug 29, 2021 · 11 comments

Comments

@KennyLeung
Copy link

2021-08-29 17:44:13.530 3073-3073/com.example.jingbin.webviewstudy E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.jingbin.webviewstudy, PID: 3073
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getVisibility()' on a null object reference
at me.jingbin.web.ByWebChromeClient.onProgressChanged(ByWebChromeClient.java:130)
at Fa.d(chromium-TrichromeWebViewGoogle.apk-stable-410410681:3)
at Cs.handleMessage(chromium-TrichromeWebViewGoogle.apk-stable-410410681:57)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

@KennyLeung
Copy link
Author

真机没问题。出错的是这一句:&& mByWebView.getErrorView().getVisibility() == View.GONE,空指针,注释掉该行,报错消失,也能正常实现全屏。

@youlookwhat
Copy link
Owner

好的,我看看哈,麻烦了~

@youlookwhat
Copy link
Owner

解决了哈,拉最新的代码试试,可以的话我提一版~

youlookwhat added a commit that referenced this issue Sep 4, 2021
fix 解决可能的空指针问题 #32
@KennyLeung
Copy link
Author

感谢,完全正常了。你这个byWebView很稳定,用了很长一段时间,没有发现内存泄漏现象,除了上面这个bug,也没观察到更多的bug。其它的webview,比如X5和AgentWeb很容易出现内存泄漏,不知道为什么。

@youlookwhat
Copy link
Owner

可能是这个里面的内容简单些~ 感谢你的使用和反馈哈,作为作者感到非常高兴😄

@youlookwhat
Copy link
Owner

@KennyLeung 已发了最新的版本哈

implementation 'com.github.youlookwhat:ByWebView:1.1.4'

@KennyLeung
Copy link
Author

KennyLeung commented Sep 7, 2021

谢谢啦。我现在直接使用ByWebView的源码的,因为需要在 OnByWebClientCallback 中增加两个用于监测和过滤广告的方法。
图片
其中doUpdateVisitedHistory用于监测网址的变化,比如浏览百度百科时,在一个词条页面打开另一个词条时,onPageFinished 和 shouldOverrideUrlLoading 都不会被触发,只有 doUpdateVisitedHistory 能监测到。而 shouldInterceptRequest 是用于过滤页面中的广告图片、js之类的。

@youlookwhat
Copy link
Owner

恩恩 可以的。

@KennyLeung
Copy link
Author

我其实不懂app开发,但为了让两小孩在看网课时,不滥用浏览器,只好自学如何编写。在开始前,寻找能全屏观看视频的开源 webview,结果发现只有很少几个项目能实现,你这个项目就是少数的几个之一。开始的出发点是观看国家中小学网络云平台上的网课,那是国家教育部联合几家互联网大企业录制的高质量中、小学同步网课,但没有APP,只能用浏览器打开,而给小孩使用浏览器,他们常会用于浏览一些非学习网站,比如游戏视频、娱乐八卦之类。直接使用你这个项目的demo,换上网址就能实现全屏观看和防止小孩浏览无关网站了。后来发现能注入js,就实现了更多的功能,比如记录上次观看位置等,也把百度百科、B站、bing等加入了,全部都通过js 过滤掉少儿不宜内容。
图片
图片
图片
图片

国家中小学网络云平台网址:https://tongbu.eduyun.cn/tbkt/tbkthtml/h5.html?xdcode=xd0002&njcode=njs007&xkcode=yuwen0
如果你有空,出一个以该网址为基础的、使用bywebview的开源网课播放app,真的是功德无量,大量苦于小孩以看网课为名、行浏览与学习无关网站之实的家长将感激不尽。

@youlookwhat
Copy link
Owner

我挺想做的,看起来能帮到很多人,但是我不知道【以该网址为基础的、使用bywebview的开源网课播放app】需要怎么做,哪些功能等,有个草图就好了。具体可以联系我哈,QQ:770413277

@KennyLeung
Copy link
Author

我挺想做的,看起来能帮到很多人,但是我不知道【以该网址为基础的、使用bywebview的开源网课播放app】需要怎么做,哪些功能等,有个草图就好了。具体可以联系我哈,QQ:770413277

加你的QQ了

eric-gitta-moore added a commit to eric-gitta-moore/ThirdWebView that referenced this issue Apr 21, 2024
fix 解决可能的空指针问题 youlookwhat/ByWebView#32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants