diff --git a/example/file/main.go b/example/file/main.go index c73c9d3..ad6414e 100644 --- a/example/file/main.go +++ b/example/file/main.go @@ -8,7 +8,6 @@ import ( "time" "github.com/Danile71/go-rtsp" - "github.com/gorilla/mux" "github.com/mattn/go-mjpeg" ) @@ -54,13 +53,8 @@ func main() { } }() - streamHandler := func(w http.ResponseWriter, r *http.Request) { - s.ServeHTTP(w, r) - } + http.Handle("/stream", s) - router := mux.NewRouter() - router.HandleFunc("/stream", streamHandler) - http.Handle("/", router) if err := http.ListenAndServe(":8181", nil); err != nil { slog.Error( "listen", diff --git a/example/url/main.go b/example/url/main.go index 0e1cdc8..168eee7 100644 --- a/example/url/main.go +++ b/example/url/main.go @@ -7,7 +7,6 @@ import ( "os" "github.com/Danile71/go-rtsp" - "github.com/gorilla/mux" "github.com/mattn/go-mjpeg" ) @@ -15,7 +14,7 @@ const uri = "rtsp://192.168.139.24:8554/mystream" func main() { // Set ffmpeg log level - rtsp.SetLogLevel(rtsp.AV_LOG_QUIET) + rtsp.SetLogLevel(rtsp.AV_LOG_TRACE) // Create mjpeg instance s := mjpeg.NewStream() @@ -67,13 +66,8 @@ func main() { } }() - streamHandler := func(w http.ResponseWriter, r *http.Request) { - s.ServeHTTP(w, r) - } + http.Handle("/stream", s) - router := mux.NewRouter() - router.HandleFunc("/stream", streamHandler) - http.Handle("/", router) if err := http.ListenAndServe(":8181", nil); err != nil { slog.Error( "listen", diff --git a/go.mod b/go.mod index 316f668..5cf16ac 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,4 @@ module github.com/Danile71/go-rtsp go 1.21 -require ( - github.com/gorilla/mux v1.8.1 - github.com/mattn/go-mjpeg v0.0.3 -) +require github.com/mattn/go-mjpeg v0.0.3 diff --git a/go.sum b/go.sum index 20f3f59..c1bb7f8 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,2 @@ -github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= -github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/mattn/go-mjpeg v0.0.3 h1:0G/+KddrbI5Hnq83B11O1O4vP7Q6L9MsBu6aW71jhUM= github.com/mattn/go-mjpeg v0.0.3/go.mod h1:65z7Cj+u5y5K3B8Sy5NtrJFTWAhguGHs9FEkADdx6kE=