Uncaught DOMException: Failed to construct 'RTCPeerConnection':当URL方案为" turn "时,需要用户名和凭据。或"turns".
I have get error.
我的代码和coturn配置是。
const iceConfiguration = {
iceServers: [
{
username: 'myuser',
credentials: 'userpassword',
urls: [
'turn:public_ip_address:3478?transport=tcp',
]
}
]
}
let peer = new RTCPeerConnection(iceConfiguration);
listening-port=3478
tls-listening-port=5349
listening-ip= turn:public_ip_address
external-ip= turn:public_ip_address
relay-ip= turn:public_ip_address
fingerprint
lt-cred-mech
user=myuser:userpassword
我试着写url没有数组[]但结果是一样的。
我能做什么?
说明属性是credential
,而不是credentials
。你是否在某个地方发现了错误的拼写?
我想这个错误是由于打错了" credential " &;
请输入:
const iceConfiguration = {
iceServers: [
{
username: 'myuser',
credential: 'userpassword',
urls: 'turn:public_ip_address:3478?transport=tcp'
}
]
}
let peer = new RTCPeerConnection(iceConfiguration);
Coturn可以通过WebRTC样本进行测试
这里有一些详细的TURN服务器测试信息
希望这些信息对你有帮助。