From 89ebf28810020bd57b010d11a0da0e0d4be494d6 Mon Sep 17 00:00:00 2001 From: dexter <178529795@qq.com> Date: Tue, 21 Feb 2023 21:29:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=B5=8B=E8=AF=95=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +++++ main.go | 11 ++++++++++- publish.html | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 publish.html 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推流 + + + +