diff --git a/README.md b/README.md index f16762f..eb38207 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,11 @@ Body: `SDP` Content-Type: `application/sdp` Response Body: `SDP` + +### 推流测试页面 + +`/webrtc/test/publish` + ## WHIP WebRTC-HTTP ingestion protocol 用于WebRTC交换SDP信息的规范 diff --git a/main.go b/main.go index e8aeb9e..d604555 100644 --- a/main.go +++ b/main.go @@ -10,8 +10,9 @@ import ( "go.uber.org/zap" "m7s.live/engine/v4" - "github.com/pion/interceptor" + _ "embed" + "github.com/pion/interceptor" . "github.com/pion/webrtc/v3" "m7s.live/engine/v4/config" "m7s.live/plugin/webrtc/v4/webrtc" @@ -43,6 +44,10 @@ import ( // conn *net.UDPConn // port int // } + +//go:embed publish.html +var publishHTML []byte + var ( reg_level = regexp.MustCompile("profile-level-id=(4.+f)") ) @@ -168,6 +173,10 @@ func (conf *WebRTCConfig) Push_(w http.ResponseWriter, r *http.Request) { } } +func (conf *WebRTCConfig) Test_Publish(w http.ResponseWriter, r *http.Request) { + w.Write(publishHTML) +} + var webrtcConfig WebRTCConfig var WebRTCPlugin = engine.InstallPlugin(&webrtcConfig) diff --git a/publish.html b/publish.html new file mode 100644 index 0000000..dc702a9 --- /dev/null +++ b/publish.html @@ -0,0 +1,55 @@ + + + + + + + + 测试WebRTC推流 + + + +