我连接到了stun turn服务器,但是onicecandidate不能工作。我正在从本地文件运行应用程序。
脚本:
const pc = new RTCPeerConnection({
iceServers:[{
urls:"stun:stun.l.google.com:19302",
},
{
url: 'turn:turn.bistri.com:80',
credential: 'homeo',
username: 'homeo'
}]
})
const dc = pc.createDataChannel("channel")
pc.onicecandidate = (e) => {
console.log("ok")
}
dc.onopen = () => {
console.log("Data Channel Opened")
}
dc.onmessage = (data) => {
console.log("Message:"+data)
}发布于 2020-05-11 14:01:06
调用pc.setLocalDescription时会发生onicecandidate事件。
你还没给setLocalDescription打电话呢。
https://stackoverflow.com/questions/61592663
复制相似问题