问题描述
我正在使用Amazon Kinesis Video Streams WebRTC在移动应用程序和网站之间进行视频聊天连接。我需要在网络端处理网络中断。让我解释一下我已经完成的步骤。
我可以检测到事件监听器上的网络已断开连接...
peerConnection.addEventListener('iceconnectionstatechange',event => {
if (event.target.connectionState === 'connected' && event.target.iceConnectionState ===
'disconnected') {
// do something to handle network interruption
}
}
在这种情况下,我将在循环时间间隔内向服务器(测试api)发送请求,以检测网络是否正常。 在网络连接正常的情况下,我将运行...(reference)
const newOffer = await peerConnection.createOffer({ iceRestart: true })
await peerConnection.setLocalDescription(newOffer)
此后,我可以看到已建立连接(connectionState / iceConnectionState状态已连接),但是我无法接收任何数据流(来自移动用户的视频被冻结)。但是1分钟后,发送流将显示在移动端。
谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)