英文:
some times camera preview freezing without touch on andoid webview app(not mobile webbrowser)
问题
有时,我的Android WebView应用程序中的相机预览会在没有触摸的情况下冻结(不是在移动网页浏览器中)。请查看下面的视频。我认为我需要修改我的Android程序来解决这个问题(可能是由于低电池问题),但我不知道该怎么做。
视频链接:https://www.youtube.com/shorts/gS0W_ku6t7E
英文:
Sometimes the camera preview is freezing without being touched in my Android WebView app (not in a mobile web browser). Please see the below video. I think I have to modify my Android program to solve this issue (possibly due to low battery problems), but I don't know what to do.
Link to video: https://www.youtube.com/shorts/gS0W_ku6t7E
答案1
得分: 1
请参考 https://github.com/react-native-webview/react-native-webview/issues/2698
建议添加一个旋转器/动画以保持视频流的实时性。
我在我的项目上测试过,对我有效。
<%-- 修复 webview 摄像头视频冻结的 bug --%>
<div style="background:linear-gradient(rgba(0,0,0,0.9), rgba(0,0,0,0.9)), url('../../Media/loading-small.gif') no-repeat center;">&nbsp;</div>
英文:
Please refer https://github.com/react-native-webview/react-native-webview/issues/2698
Suggested to add a spinner/animation helps to keep the video feed live.
I tested it on my project and it works for me.
<%-- Fixed webview bug camera video frozen --%>
<div style="background:linear-gradient(rgba(0,0,0,0.9), rgba(0,0,0,0.9)), url('../../Media/loading-small.gif') no-repeat center;">&nbsp;</div>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论