gpt4 book ai didi

android - 如何解决 webview 播放音频的问题

转载 作者:行者123 更新时间:2023-11-30 04:58:18 24 4
gpt4 key购买 nike

我在 WebView 中使用我的网站来创建我网站的应用程序。我的站点有一个部分可以播放来自其他站点的声音。我的网站是 https 而其他网站是 http 。当想播放歌曲时从 android studio 得到这个错误

    E/EGL_emulation: eglQueryContext 32c0  EGL_BAD_ATTRIBUTE
E/EGL_emulation: tid 3170: eglQueryContext(1456): error 0x3004 (EGL_BAD_ATTRIBUTE)
I/chromium: [INFO:CONSOLE(0)] "Mixed Content: The page at 'https://mysiteurl' was loaded over HTTPS, but requested an insecure video 'http://othersiteurl'. This request has been blocked; the content must be served over HTTPS.", source: https://mysiteurl (0)
I/chromium: [INFO:CONSOLE(0)] "Uncaught (in promise) NotSupportedError: Failed to load because no supported source was found.", source: undefined (0)

我该如何解决这个问题

最佳答案

你必须添加

android:usesCleartextTraffic="true"

AndroidManifest.xml 中的应用程序标签并添加

if (Build.VERSION.SDK_INT >= 21) {
mWebView.getSettings().setMixedContentMode( WebSettings.MIXED_CONTENT_ALWAYS_ALLOW );
}

进入 OnCreate 您的 Activity

关于android - 如何解决 webview 播放音频的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58748670/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com