mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-07-22 09:37:09 +00:00
Use google stun only (#43)
This commit is contained in:
parent
6c71f4221f
commit
3f61637337
2 changed files with 11 additions and 10 deletions
2
static/js/ws.js
vendored
2
static/js/ws.js
vendored
|
|
@ -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', {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue