diff --git a/main.go b/main.go index 8eb2ab3..163154a 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,7 @@ package main import ( "log" + "net" "strings" "github.com/spf13/viper" @@ -66,6 +67,14 @@ func loadConfiguration() { // Copy STUN configuration to clients viper.Set("Web.STUNServers", viper.Get("WebRTC.STUNServers")) + + // Copy SRT server port to display it on web page + hostport := viper.GetString("Srt.ListenAddress") + _, srtPort, err := net.SplitHostPort(hostport) + if err != nil { + log.Fatalf("Failed to split host and port from %s", hostport) + } + viper.Set("Web.SRTServerPort", srtPort) } func main() { diff --git a/web/template/index.html b/web/template/index.html index dc0b306..60eb3f7 100644 --- a/web/template/index.html +++ b/web/template/index.html @@ -21,11 +21,11 @@