Open yeyuezhishou opened 1 month ago
问题1: 如果RTCPeerConnection 连接不设置RTCConfiguration参数,会发现连接监听的 @pc.on("connectionstatechange") async def on_connectionstatechange():代码,很耗时,大概要5s左右,如果使用STUN服务器,配置RTCConfiguration,指定RTCIceServer,会发现连接和监听很快了,但是会出现传输过程中偶尔出现音视频卡顿问题,不使用STUN,就不会出现卡顿,但是连接又很慢,有没有好的思路和建议解决这个问题,代码片段
ice_server = RTCIceServer( urls="turn:106.xx.XX.XX:3478", username="Vach", credential="Vach~XX" ) configuration = RTCConfiguration(iceServers=[ice_server]) pc = RTCPeerConnection(configuration) pcs.add(pc) @pc.on("connectionstatechange") async def on_connectionstatechange(): logging.info("Connection state is %s" % pc.connectionState)
问题1: 如果RTCPeerConnection 连接不设置RTCConfiguration参数,会发现连接监听的 @pc.on("connectionstatechange") async def on_connectionstatechange():代码,很耗时,大概要5s左右,如果使用STUN服务器,配置RTCConfiguration,指定RTCIceServer,会发现连接和监听很快了,但是会出现传输过程中偶尔出现音视频卡顿问题,不使用STUN,就不会出现卡顿,但是连接又很慢,有没有好的思路和建议解决这个问题,代码片段
预先获取ICE服务器配置 在服务器上已经安装coturn