我正在使用ProjectRTC,我使用Firefox和Android客户端成功测试了它。我将服务器代码放在远程服务器(digitalocean)上,通过我的家用电脑访问。
然而,一切正常,直到我使用家庭ADSL测试它,或者(慢速)ADSL用于带有Firefox的PC和用于Android客户端的3G / 4G网络。
如果我通过手机(使用热点选项)为我的电脑使用3G / 4G网络,它会尝试连接到客户端,但我收到错误 javascript控制台上的“Ice Failed”。
我尝试在
上添加TURN客户端public/javascripts/rtcClient.js
添加:
var localId,
config = {
peerConnectionConfig: {
iceServers: [
/*test*/
{
"username":"e7db750a-2fcc-40c6-8415-cab22743a68a",
"url": "turn:turn1.xirsys.com:443?transport=tcp",
"credential":"287ae254-9380-4f81-af88-e1cc9ed27eb0"
},
{
"username":"e7db750a-2fcc-40c6-8415-cab22743a68a",
"url": "turn:turn1.xirsys.com:443?transport=udp",
"credential":"287ae254-9380-4f81-af88-e1cc9ed27eb0"
},
/*end test*/
{
"url": "stun:stun.l.google.com:19305"
}
]
},
peerConnectionConstraints: {
optional: [{
"DtlsSrtpKeyAgreement": true,
}]
}
},
peerDatabase = {},
localStream,
remoteVideoContainer = document.getElementById('remoteVideosContainer'),
socket = io();
socket.on('message', handleMessage);
socket.on('id', function(id) {
localId = id;
});
但我仍然没有运气,再次“ICE失败”。
我也尝试阅读this,但我认为这不是我要搜索的内容。 你有任何想法让它与移动连接一起工作吗?
提前感谢您的关注!
答案 0 :(得分:0)
不要对你的ICE字符串进行硬编码。 XirSys ICE字符串是时间敏感的,将在30秒后过期。您需要为每个连接请求一个新的ICE字符串。这可能会解决您的问题,也可能不会,但它至少会排除ICE字符串的问题。
此致 利