fix: play add query

This commit is contained in:
langhuihui
2023-12-08 19:06:05 +08:00
parent 538e4e7033
commit 99b470948c

View File

@@ -140,6 +140,7 @@ func (conf *WebRTCConfig) OnEvent(event any) {
func (conf *WebRTCConfig) Play_(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/sdp")
streamPath := r.URL.Path[len("/play/"):]
rawQuery := r.URL.RawQuery
bytes, err := io.ReadAll(r.Body)
var suber WebRTCSubscriber
suber.SDP = string(bytes)
@@ -159,6 +160,9 @@ func (conf *WebRTCConfig) Play_(w http.ResponseWriter, r *http.Request) {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
if rawQuery != "" {
streamPath += "?" + rawQuery
}
if err = WebRTCPlugin.Subscribe(streamPath, &suber); err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return