mirror of
https://github.com/Monibuca/plugin-rtsp.git
synced 2025-10-24 08:03:28 +08:00
修改API
This commit is contained in:
6
main.go
6
main.go
@@ -42,7 +42,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
func runPlugin() {
|
func runPlugin() {
|
||||||
|
|
||||||
http.HandleFunc("/rtsp/list", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/api/rtsp/list", func(w http.ResponseWriter, r *http.Request) {
|
||||||
sse := NewSSE(w, r.Context())
|
sse := NewSSE(w, r.Context())
|
||||||
var err error
|
var err error
|
||||||
for tick := time.NewTicker(time.Second); err == nil; <-tick.C {
|
for tick := time.NewTicker(time.Second); err == nil; <-tick.C {
|
||||||
@@ -55,8 +55,8 @@ func runPlugin() {
|
|||||||
err = sse.WriteJSON(info)
|
err = sse.WriteJSON(info)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
http.HandleFunc("/rtsp/pull", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/api/rtsp/pull", func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
CORS(w, r)
|
||||||
targetURL := r.URL.Query().Get("target")
|
targetURL := r.URL.Query().Get("target")
|
||||||
streamPath := r.URL.Query().Get("streamPath")
|
streamPath := r.URL.Query().Get("streamPath")
|
||||||
if err := new(RTSP).PullStream(streamPath, targetURL); err == nil {
|
if err := new(RTSP).PullStream(streamPath, targetURL); err == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user