ryanemax 3 недель назад
Родитель
Сommit
4a38c0878a
2 измененных файлов с 17 добавлено и 0 удалено
  1. 1 0
      android/app/src/main/AndroidManifest.xml
  2. 16 0
      faq.webgl.md

+ 1 - 0
android/app/src/main/AndroidManifest.xml

@@ -9,6 +9,7 @@
         android:supportsRtl="true"
         android:networkSecurityConfig="@xml/network_security_config"
         android:hardwareAccelerated="true"
+        android:largeHeap="true"
         android:theme="@style/AppTheme">
 
         <activity

+ 16 - 0
faq.webgl.md

@@ -0,0 +1,16 @@
+# WebGL 安卓卡顿问题
+
+# 同类情况
+- https://cloud.tencent.com/developer/article/2336102
+> 项目要求支持 8K 高清视频(H265编码)播放,拿到板子后却发现使用 App 可以播放 8K 高清视频,但使用浏览器却不行,即使安装上最新的 Chrome for Android 也不行。根据以往的浏览器内核开发经验,在 Android 平台上,Chromium WebView 最终是调用系统框架层的 MediaPlayer 进行播放。理论上只要系统框架层能够支持 8K 高清播放,那么浏览器应该也支持。实际情况却并非如此,而且 Android 10 预编译 WebView 没任何日志输出,所以需要下载源码编译 Chromium WebView,找出问题所在。
+
+# 原因分析
+- Android 10 + Capacitor打包浏览器,默认换回了System Webview,导致WebGL卡顿
+> On Android 5 and 6, Capacitor uses the Android System WebView. On Android 7+, Google Chrome is used.
+> the Android 10+ using the System WebView again
+
+# 解决方案
+- AndroidManifest.xml
+    - android:largeHeap="true"
+    - android:immersive="true"
+Try setting android:largeHeap="true" in your AndroidManifest.xml - Does that make any difference for you? It seemed to make an improvement for us. We also added android:immersive="true" (fits our app) and android:hardwareAccelerated="true" (defaults to true, but... just in case.)