mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
add screencast to capture.
This commit is contained in:
@ -63,6 +63,7 @@ func (h *RoomHandler) Route(r chi.Router) {
|
||||
r.Route("/screen", func(r chi.Router) {
|
||||
r.With(auth.CanWatchOnly).Get("/", h.screenConfiguration)
|
||||
r.With(auth.CanWatchOnly).Get("/image", h.screenImageGet)
|
||||
r.With(auth.CanWatchOnly).Get("/cast", h.screenCastGet)
|
||||
|
||||
r.With(auth.AdminsOnly).Post("/", h.screenConfigurationChange)
|
||||
r.With(auth.AdminsOnly).Get("/configurations", h.screenConfigurationsList)
|
||||
|
@ -95,3 +95,16 @@ func (h *RoomHandler) screenImageGet(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "image/jpeg")
|
||||
w.Write(out.Bytes())
|
||||
}
|
||||
|
||||
func (h *RoomHandler) screenCastGet(w http.ResponseWriter, r *http.Request) {
|
||||
screencast := h.capture.Screencast()
|
||||
if !screencast.Enabled() {
|
||||
utils.HttpBadRequest(w, "Screencast pipeline is not enabled.")
|
||||
return
|
||||
}
|
||||
|
||||
bytes := screencast.Image()
|
||||
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
|
||||
w.Header().Set("Content-Type", "image/jpeg")
|
||||
w.Write(bytes)
|
||||
}
|
||||
|
Reference in New Issue
Block a user