aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2020-06-21 17:39:28 +0000
committerdakkar <dakkar@thenautilus.net>2020-07-25 11:56:19 +0000
commita1bb76a989992983e5e7f7088780c9f067e724a9 (patch)
tree8abacda7a30bed33df95926ab66f511a9d94b340
parentUpdate module pion/webrtc/v2 to v2.2.21 (diff)
downloadrtwatch-a1bb76a989992983e5e7f7088780c9f067e724a9.tar.gz
rtwatch-a1bb76a989992983e5e7f7088780c9f067e724a9.tar.bz2
rtwatch-a1bb76a989992983e5e7f7088780c9f067e724a9.zip
allow path prefix
-rw-r--r--main.go6
1 files 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))