6

我在我的一个项目中使用RTCmulticonnection一切正常,除了它不在不同的网络上工作。我已经经历了Github 问题,该问题指出它需要打开服务器才能在不同的网络上运行它。但我已经根据文档配置了转服务器。

这是我的代码

<script src="https://rtcmulticonnection.herokuapp.com/dist/RTCMultiConnection.min.js"></script>
<script src="https://rtcmulticonnection.herokuapp.com/socket.io/socket.io.js"></script>

<script>
var connection = new RTCMultiConnection();

// this line is VERY_important
connection.socketURL = 'https://rtcmulticonnection.herokuapp.com:443/';

// if you want audio+video conferencing
connection.session = {
    audio: true,
    video: true
};

// first step, ignore default STUN+TURN servers
connection.iceServers = [];

// second step, set STUN url
connection.iceServers.push({
    urls: 'stun:mydimain.com:3478'
});

// last step, set TURN url (recommended)
connection.iceServers.push({
    urls: 'turn:mydimain.com:3478',
    credential: 'mypassword',
    username: 'myusername'
});

connection.openOrJoin('this-is-your-room-id');
</script>

在 chrome 中检查控制台时,它不会显示任何错误,但在 Firefox 中我收到以下错误...

ICE 失败,您的 TURN 服务器似乎已损坏,有关详细信息,请参阅 about:webrtc。

我已经在Trickle ICE中测试了我的回合服务器。我得到了响应和中继,这意味着转动和眩晕工作正常。我还在这个片段中检查了连接性,它显示了

是的,TURN 服务器工作...

当客户端启动会话时,我可以连接到他,几(2-3)分钟后断开连接。但是当我启动会话时,它不会与客户端连接。

出于测试目的可能是你可以使用这个我从Github得到这个

// second step, set STUN url
    connection.iceServers.push({
        urls: 'stun:numb.viagenie.ca'
    });
    
    // last step, set TURN url (recommended)
    connection.iceServers.push({
        urls: 'turn:numb.viagenie.ca',
        credential: 'muazkh',
        username: 'webrtc@live.com'
    });

在 WEBRTC-internals icecandidateerror 中出现以下错误

url: turns:mydimain.com:5349?transport=tcp
address: xxx.xxx.xx.x
port: 63612
host_candidate: address: xxx.xxx.xx.x:63612
error_text: Address not associated with the desired network interface.
error_code: 600

现在我做错了什么?任何帮助将不胜感激。谢谢

4

0 回答 0