关于视频URL 使用http 混合 https在安卓播放器中不能正常播放的问题
相关报错1:BufferQueue has been abandoned
相关报错2:MEDIA_ERROR_IJK_PLAYER = -10000
相关报错3:
Fixing “Cleartext HTTP traffic not permitted” errors
This error will occur if your app requests cleartext HTTP traffic (i.e., http:// rather than https://) when its Network Security Configuration does not permit it. If your app targets Android 9 (API level 28) or later, cleartext HTTP traffic is disabled by the default configuration.
If your app needs to work with cleartext HTTP traffic then you need to use a Network Security Configuration that permits it. Please see Android’s network security documentation for details. To enable all cleartext HTTP traffic, you can simply add android:usesCleartextTraffic=“true” to the application element of your app’s AndroidManifest.xml.
The ExoPlayer demo app uses the default Network Security Configuration, and so does not allow cleartext HTTP traffic. You can enable it using the instructions above.
如果您的应用程序请求明文HTTP流量(即,当网络安全配置不允许时,使用http://而不是https://)),则会发生此错误。如果你的应用目标是Android 9 (API级别28)或更高版本,明文HTTP流量将被默认配置禁用。
如果你的应用程序需要使用明文HTTP通信,那么你需要使用一个允许它的网络安全配置。详情请参阅Android的网络安全文档。要启用所有明文HTTP流量,您可以简单地添加android:usesCleartextTraffic="true"到应用程序的AndroidManifest.xml的应用程序元素。
ExoPlayer演示应用程序使用默认的网络安全配置,因此不允许明文HTTP流量。您可以使用上面的说明启用它。
解决方式1
// 在AndroidManifest.xml 文件下application内添加 android:usesCleartextTraffic=“true”
var foo = 'bar';
<application
android:usesCleartextTraffic="true"
...
application>
解决方式2
<?xml version="1.0" encoding="utf-8"?><network-security-config>
<base-config cleartextTrafficPermitted="true"/>
</network-security-config>
```
- 然后在application中添加配置
```
<application
.....
android:networkSecurityConfig="@xml/network_security_config"
.......>
```
下面是两个巨大的求打赏的二维码: