owncast/webserver/handlers/admin/disconnect.go

22 lines
525 B
Go
Raw Normal View History

package admin
import (
"net/http"
"github.com/owncast/owncast/core"
webutils "github.com/owncast/owncast/webserver/utils"
"github.com/owncast/owncast/core/rtmp"
)
2020-11-13 02:14:59 +03:00
// DisconnectInboundConnection will force-disconnect an inbound stream.
func DisconnectInboundConnection(w http.ResponseWriter, r *http.Request) {
if !core.GetStatus().Online {
webutils.WriteSimpleResponse(w, false, "no inbound stream connected")
return
}
rtmp.Disconnect()
webutils.WriteSimpleResponse(w, true, "inbound stream disconnected")
}