Use google stun only (#43)

This commit is contained in:
giongto35 2019-05-26 04:45:12 +08:00 committed by GitHub
parent 3fee972e57
commit 4bf3e37fa2
2 changed files with 11 additions and 10 deletions

2
static/js/ws.js vendored
View file

@ -96,7 +96,7 @@ function sendPing() {
function startWebRTC() {
// webrtc
pc = new RTCPeerConnection({iceServers: [{urls: ['stun:159.65.141.209:3478', 'stun:stun.l.google.com:19302', 'stun:stun1.l.google.com:19302']}]})
pc = new RTCPeerConnection({iceServers: [{urls: ['stun:stun.l.google.com:19302']}]})
// input channel, ordered + reliable, id 0
inputChannel = pc.createDataChannel('a', {

View file

@ -16,7 +16,7 @@ import (
"github.com/pion/webrtc/v2/pkg/media"
)
var webrtcconfig = webrtc.Configuration{ICEServers: []webrtc.ICEServer{{URLs: []string{"stun:159.65.141.209:3478", "stun:stun.l.google.com:19302", "stun:stun1.l.google.com:19302"}}}}
var webrtcconfig = webrtc.Configuration{ICEServers: []webrtc.ICEServer{{URLs: []string{"stun:stun.l.google.com:19302"}}}}
// Allows compressing offer/answer to bypass terminal input limits.
const compress = false
@ -196,14 +196,15 @@ func (w *WebRTC) StartClient(remoteSession string, iceCandidates [][]byte, width
}
// Parse candidates list
for _, bcandidate := range iceCandidates {
iceCandidate := webrtc.ICECandidateInit{}
if err := json.Unmarshal(bcandidate, &iceCandidate); err != nil {
log.Println("Cannot parse ", bcandidate)
continue
}
w.connection.AddICECandidate(iceCandidate)
}
// This logic is wrong
//for _, bcandidate := range iceCandidates {
//iceCandidate := webrtc.ICECandidateInit{}
//if err := json.Unmarshal(bcandidate, &iceCandidate); err != nil {
//log.Println("Cannot parse ", bcandidate)
//continue
//}
//w.connection.AddICECandidate(iceCandidate)
//}
answer, err := w.connection.CreateAnswer(nil)
if err != nil {