lazy screencast.

This commit is contained in:
Miroslav Šedivý
2021-01-23 15:17:52 +01:00
parent 75393905e8
commit fdd98377b3
5 changed files with 83 additions and 30 deletions

View File

@ -63,7 +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.CanWatchOnly).Get("/cast.jpg", h.screenCastGet)
r.With(auth.AdminsOnly).Post("/", h.screenConfigurationChange)
r.With(auth.AdminsOnly).Get("/configurations", h.screenConfigurationsList)

View File

@ -103,7 +103,12 @@ func (h *RoomHandler) screenCastGet(w http.ResponseWriter, r *http.Request) {
return
}
bytes := screencast.Image()
bytes, err := screencast.Image()
if err != nil {
utils.HttpInternalServerError(w, err)
return
}
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
w.Header().Set("Content-Type", "image/jpeg")
w.Write(bytes)