disconnect.go 518 B

123456789101112131415161718192021
  1. package admin
  2. import (
  3. "net/http"
  4. "github.com/owncast/owncast/controllers"
  5. "github.com/owncast/owncast/core"
  6. "github.com/owncast/owncast/core/rtmp"
  7. )
  8. // DisconnectInboundConnection will force-disconnect an inbound stream.
  9. func DisconnectInboundConnection(w http.ResponseWriter, r *http.Request) {
  10. if !core.GetStatus().Online {
  11. controllers.WriteSimpleResponse(w, false, "no inbound stream connected")
  12. return
  13. }
  14. rtmp.Disconnect()
  15. controllers.WriteSimpleResponse(w, true, "inbound stream disconnected")
  16. }