Files
core/http/handler/api/srt.go
Jan Stabenow eb1cc37456 Add GoSRT & improvements (repo-merge)
Commits (Ingo Oppermann):
- Add experimental SRT connection stats and logs
- Hide /config/reload endpoint in reade-only mode
- Add SRT server
- Create v16 in go.mod
- Fix data races, tests, lint, and update dependencies
- Add trailing slash for routed directories (datarhei/restreamer#340)
- Allow relative URLs in content in static routes

Co-Authored-By: Ingo Oppermann <57445+ioppermann@users.noreply.github.com>
2022-06-23 22:13:58 +02:00

36 lines
834 B
Go

package api
import (
"net/http"
"github.com/datarhei/core/v16/srt"
"github.com/labstack/echo/v4"
)
// The SRTHandler type provides a handler for retrieving details from the SRTHandler server
type SRTHandler struct {
srt srt.Server
}
// NewRTMP returns a new SRT type. You have to provide a SRT server instance.
func NewSRT(srt srt.Server) *SRTHandler {
return &SRTHandler{
srt: srt,
}
}
// ListChannels lists all currently publishing SRT streams
// @Summary List all publishing SRT treams
// @Description List all currently publishing SRT streams
// @ID srt-3-list-channels
// @Produce json
// @Success 200 {array} api.SRTChannel
// @Security ApiKeyAuth
// @Router /api/v3/srt [get]
func (srth *SRTHandler) ListChannels(c echo.Context) error {
channels := srth.srt.Channels()
return c.JSON(http.StatusOK, channels)
}