Android11-WebrtcVOIP呼叫在浏览器或桌面应用程序中无法工作,但在Android10中可以工作。
创始人
2024-08-20 09:30:32
0

可能是因为Android 11中已经更改了网络连接权限的处理方式,因此导致Webrtc VOIP呼叫无法正常工作。为解决这个问题,可以尝试加入以下代码:

//在AndroidManifest.xml文件中添加以下权限请求

//在代码中使用以下代码配置Webrtc客户端

PeerConnectionFactory.initialize(PeerConnectionFactory.InitializationOptions.builder(this)

    .createInitializationOptions());

PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();

DefaultVideoEncoderFactory defaultVideoEncoderFactory = new DefaultVideoEncoderFactory(

    rootEglBase.getEglBaseContext(), true /* enableIntelVp8Encoder */, true);

DefaultVideoDecoderFactory defaultVideoDecoderFactory = new DefaultVideoDecoderFactory(

    rootEglBase.getEglBaseContext());

PeerConnectionFactory peerConnectionFactory = PeerConnectionFactory.builder()

    .setOptions(options)

    .setVideoEncoderFactory(defaultVideoEncoderFactory)

    .setVideoDecoderFactory(defaultVideoDecoderFactory)

    .createPeerConnectionFactory();

//配置STUN和TURN服务器

List iceServers = new ArrayList<>();

iceServers.add(PeerConnection.IceServer.builder("stun:stun.l.google.com:19302").createIceServer());

iceServers.add(PeerConnection.IceServer.builder("turn:turn.example.org").setUsername("username").setPassword("password").createIceServer());

PeerConnectionFactory.Options rtcConfig = new PeerConnectionFactory.Options();

rtcConfig.setIceServerUrls(Collections.singletonList("stun:stun.l.google.com:19302"));

rtcConfig.setIceServers(iceServers);

PeerConnectionFactory.initialize(PeerConnectionFactory.InitializationOptions.builder(this).setPeerConnectionFactoryOptions(rtcConfig).createInitializationOptions());

//创建PeerConnection

PeerConnectionFactory.Options rtcConfig = new PeerConnectionFactory.Options();

rtcConfig.setIceServerUrls(Collections.singletonList("stun:stun.l.google

相关内容

热门资讯

透视辅助!雀神广东麻将输赢规律... 透视辅助!雀神广东麻将输赢规律(辅助挂)确实是真的有挂(有挂讲解)-哔哩哔哩;一、雀神广东麻将输赢规...
分享个大家!小甘麻将助赢神器(... 1、分享个大家!小甘麻将助赢神器(辅助挂)其实真的有挂(有挂分析)-哔哩哔哩;详细教程。2、小甘麻将...
1分钟科普!微扑克辅助机器人(... 1分钟科普!微扑克辅助机器人(辅助挂)透视辅助((2023已更新))(哔哩哔哩),您好,微扑克辅助这...
关于!hm3德州辅助怎么购买!... 关于!hm3德州辅助怎么购买!竟然真的有挂((2020已更新))(哔哩哔哩)是由北京得hm3德州黑科...
如何分辨真伪!广东小程序辅助购... 如何分辨真伪!广东小程序辅助购买(辅助挂)确实真的有挂(真是有挂)-哔哩哔哩;玩家必备必赢加哟《13...
透视安卓版!会友山西麻将有没有... 透视安卓版!会友山西麻将有没有挂(辅助挂)的确真的有挂(有挂技术)-哔哩哔哩;亲真的是有正版授权,小...
1分钟科普!德州wpk辅助(透... 1分钟科普!德州wpk辅助(透视)软件透明挂((2023已更新))(哔哩哔哩);wpk辅助辅助插件是...
盘点一款!轰趴大菠萝十三水辅助... 盘点一款!轰趴大菠萝十三水辅助!其实真的有挂((2022已更新))(哔哩哔哩)1、许多玩家不知道轰趴...
4分钟了解!广东雀神智能辅助软... 广东雀神辅助器最新版版本稳定性对比与推荐‌:4分钟了解!广东雀神智能辅助软件(辅助挂)竟然是真的有挂...
玩家必看教程!喜扣跑胡子有挂吗... 玩家必看教程!喜扣跑胡子有挂吗(辅助挂)果真是真的有挂(有挂方针)-哔哩哔哩;一、喜扣跑胡子有挂吗A...