1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2025-06-27 11:28:51 +02:00

Make STUN server configurable

This commit is contained in:
Alexandre Iooss
2020-09-29 17:27:19 +02:00
parent 1c98754624
commit 95f4b81f01
6 changed files with 24 additions and 15 deletions

View File

@ -3,12 +3,7 @@ let peerConnection;
startPeerConnection = () => {
// Init peer connection
peerConnection = new RTCPeerConnection({
iceServers: [
{
// FIXME: let admin customize the stun server
urls: 'stun:stun.l.google.com:19302'
}
]
iceServers: [{ urls: stunServers }]
})
// On connection change, change indicator color
@ -80,6 +75,3 @@ startPeerConnection = () => {
}
}
}
// Start
startPeerConnection()

View File

@ -36,4 +36,12 @@
<script src="/static/js/sideWidget.js"></script>
<script src="/static/js/viewer.js"></script>
<script>
const stunServers = [
{{range $id, $value := .Cfg.STUNServers}}
'{{$value}}',
{{end}}
]
startPeerConnection()
</script>
{{end}}

View File

@ -20,6 +20,9 @@ type Options struct {
Hostname string
Favicon string
WidgetURL string
// Copied from WebRTC configuration
STUNServers []string
}
var (