我正在开发一个 webrtc 应用程序,并且必须实现以下 TURN 服务器。
https://code.google.com/p/rfc5766-turn-server/ https://code.google.com/p/rfc5766-turn-server/
我正在关注这个教程。
http://www.dialogic.com/den/developer_forums/f/71/t/10238.aspx http://www.dialogic.com/den/developer_forums/f/71/t/10238.aspx
它表示在创建 RTCPeerConnection 的 JavaScript 代码中按如下方式引用 TURN 服务器。
var pc_config = {"iceServers": [{"url": "stun:stun.l.google.com:19302"},
{"url":"turn:<turn_server_ip_address>", "username":"my_username", "credential":"my_password"}]};
pc_new = new webkitRTCPeerConnection(pc_config);
我有点困惑,为什么我们引用 Google 公共 STUN 服务器。我认为 RFC 5766 TURN 服务器内部有 STUN。
RFC5766 是唯一的 TURN 服务器吗?而不是 STUN 服务器?难道我们不能实现自己的 STUN 服务器而不是使用 Google 提供的服务器吗?
抱歉问这么幼稚的问题。我是 WebRTC 新手。
Thanks.
TURN是STUN的扩展,因此TURN服务器也具有STUN的功能。
https://code.google.com/p/rfc5766-turn-server/ https://code.google.com/p/rfc5766-turn-server/也可用作 STUN,因此您可以尝试编写如下内容:
var pc_config = {
"iceServers": [{
"url":"turn:my_username@<turn_server_ip_address>",
"credential":"my_password"
}]
};
pc_new = new webkitRTCPeerConnection(pc_config);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)