From a1bb76a989992983e5e7f7088780c9f067e724a9 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 21 Jun 2020 17:39:28 +0000 Subject: allow path prefix --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 8e6befc..f7ad319 100644 --- a/main.go +++ b/main.go @@ -103,8 +103,10 @@ type websocketMessage struct { func main() { containerPath := "" httpListenAddress := "" + httpPath := "" flag.StringVar(&containerPath, "container-path", "", "path to the media file you want to playback") flag.StringVar(&httpListenAddress, "http-listen-address", ":8080", "address for HTTP server to listen on") + flag.StringVar(&httpPath, "http-path", "/rtwatch", "URI path prefix") flag.Parse() if containerPath == "" { @@ -135,8 +137,8 @@ func main() { pipeline = gst.CreatePipeline(containerPath, audioTrack, videoTrack) pipeline.Start() - http.HandleFunc("/", serveHome) - http.HandleFunc("/ws", serveWs) + http.HandleFunc(httpPath, serveHome) + http.HandleFunc(httpPath + "/ws/", serveWs) fmt.Println(fmt.Sprintf("Video file '%s' is now available on '%s', have fun!", containerPath, httpListenAddress)) log.Fatal(http.ListenAndServe(httpListenAddress, nil)) -- cgit v1.2.3