mirror of
https://github.com/Monibuca/plugin-webrtc.git
synced 2025-10-05 14:56:56 +08:00
streamPath获取方式修改防止意外
This commit is contained in:
4
main.go
4
main.go
@@ -83,7 +83,7 @@ func (conf *WebRTCConfig) OnEvent(event any) {
|
|||||||
|
|
||||||
func (conf *WebRTCConfig) Play_(w http.ResponseWriter, r *http.Request) {
|
func (conf *WebRTCConfig) Play_(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/sdp")
|
w.Header().Set("Content-Type", "application/sdp")
|
||||||
streamPath := r.URL.Path[12:]
|
streamPath := r.URL.Path[len("/webrtc/play/"):]
|
||||||
bytes, err := ioutil.ReadAll(r.Body)
|
bytes, err := ioutil.ReadAll(r.Body)
|
||||||
var suber WebRTCSubscriber
|
var suber WebRTCSubscriber
|
||||||
suber.SDP = string(bytes)
|
suber.SDP = string(bytes)
|
||||||
@@ -112,7 +112,7 @@ func (conf *WebRTCConfig) Play_(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (conf *WebRTCConfig) Push_(w http.ResponseWriter, r *http.Request) {
|
func (conf *WebRTCConfig) Push_(w http.ResponseWriter, r *http.Request) {
|
||||||
streamPath := r.URL.Path[12:]
|
streamPath := r.URL.Path[len("/webrtc/push/"):]
|
||||||
w.Header().Set("Content-Type", "application/sdp")
|
w.Header().Set("Content-Type", "application/sdp")
|
||||||
bytes, err := ioutil.ReadAll(r.Body)
|
bytes, err := ioutil.ReadAll(r.Body)
|
||||||
var puber WebRTCPublisher
|
var puber WebRTCPublisher
|
||||||
|
Reference in New Issue
Block a user