关于视频URL 使用http 混合 https在安卓播放器中不能正常播放的问题BufferQueue has been abandoned MEDIA_ERROR_IJK_PLAYER = -100

关于视频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"
        .......>
```

下面是两个巨大的求打赏的二维码:
这里写图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值