直播:画质可选、只读 /live/info、弹幕 WS 透传;Nginx 弹幕路径

Made-with: Cursor
This commit is contained in:
whm
2026-03-26 10:07:49 +08:00
parent 6b3210f714
commit 106e6e1f16
11 changed files with 417 additions and 8 deletions

View File

@@ -32,7 +32,9 @@ type wsEnvelope struct {
func RegisterRoutes(r gin.IRoutes) {
r.GET("/live/status", handleLiveStatus)
r.GET("/live/info", handleLiveInfo)
r.GET("/live/ws", handleLiveWS)
r.GET("/live/danmaku/ws", handleDanmakuWS)
}
func handleLiveStatus(c *gin.Context) {
@@ -90,12 +92,14 @@ func handlePublisherWS(c *gin.Context, h *Hub) {
return
}
h.publishConn = ws
h.publishQuality = normalizeQuality(c.Query("quality"))
h.mu.Unlock()
pc, err := h.api.NewPeerConnection(h.cfg)
if err != nil {
h.mu.Lock()
h.publishConn = nil
h.publishQuality = ""
h.mu.Unlock()
_ = ws.Close()
return