mirror of
https://github.com/Monibuca/plugin-webrtc.git
synced 2025-10-19 13:14:40 +08:00
fix: play add query
This commit is contained in:
4
main.go
4
main.go
@@ -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
|
||||
|
Reference in New Issue
Block a user