【发布时间】:2016-12-13 15:53:49
【问题描述】:
我实际上已经关注了这个 WebRTC 代码实验室 (https://codelabs.developers.google.com/codelabs/webrtc-web/#7),但是在需要连接到 ICE 服务器时卡住了。
这里的基本代码:
main.js
var pcConfig = {
'iceServers': [{
'url': 'stun:stun.l.google.com:19302'
}
[...]
if (location.hostname !== 'localhost') {
requestTurn(
'https://computeengineondemand.appspot.com/turn?username=41784574&key=4080218913');}
通常我会收到以下错误:“ICE failed”,或者 “跨域请求被阻止:同源策略不允许读取位于https://computeengineondemand.appspot.com/turn?username=41784574&key=4080218913 的远程资源。 (原因:缺少 CORS 标头“Access-Control-Allow-Origin”)。”
根据后一个,我启用了 “A2enmod headers”并将其设置为 apache.conf “Header always set Access-Control-Allow-Origin "*" “
问题仍然存在。我的 STUN 服务器是“'url': 'stun:stun.l.google.com:19302'” 据我了解,STUN 应该在 80% 的时间内工作。但这永远行不通。因此,即使 TURNserver 不再工作,它有时也应该与 STUN 连接?
【问题讨论】:
-
跟我一样关心!我可以添加你的电报\skype 来讨论这个解决方案吗?
-
我还没有找到解决方案,但欢迎您给我发邮件 gideonscontikk@gmail.com
-
所以我终于发现我办公室的网络阻塞了一切——STUN 服务器总是失败。我建立了一个自己的 TURN 服务器和 ta-daa - 视频通话终于可以工作了
-
用这个demo.easyrtc.com/demos/demo_ice_filter.html做了一些有用的测试
标签: node.js webrtc stun rfc5766turnserver