diff --git a/backend/app/controllers/public/replay_controller.rb b/backend/app/controllers/public/replay_controller.rb index 72184ab..e58dea9 100644 --- a/backend/app/controllers/public/replay_controller.rb +++ b/backend/app/controllers/public/replay_controller.rb @@ -1,5 +1,7 @@ module Public class ReplayController < SiteBaseController + include Public::LiveHelper + layout "marketing_live" before_action :set_session_and_recording, only: %i[show stream thumbnail download] diff --git a/backend/app/services/recordings/serve_from_storage.rb b/backend/app/services/recordings/serve_from_storage.rb index bccb2c5..c99c2df 100644 --- a/backend/app/services/recordings/serve_from_storage.rb +++ b/backend/app/services/recordings/serve_from_storage.rb @@ -6,6 +6,8 @@ module Recordings # Serve file replay/thumbnail al browser senza esporre URL S3 interni (es. http://garage:3900). class ServeFromStorage CHUNK_SIZE = 256 * 1024 + # Thumbnail e file piccoli: buffer completo (l'Enumerator su Puma può non completare la risposta). + SMALL_FILE_MAX = 2 * 1024 * 1024 def initialize(key:, content_type:, disposition: "inline", filename: nil) @key = key @@ -55,6 +57,15 @@ module Recordings controller.status = :partial_content if range.present? && resp.content_range.present? + if range.blank? && resp.content_length.to_i.positive? && resp.content_length.to_i <= SMALL_FILE_MAX + return controller.send_data( + resp.body.read, + type: @content_type, + disposition: @disposition, + filename: @filename + ) + end + body = resp.body controller.response_body = Enumerator.new do |yielder| while (chunk = body.read(CHUNK_SIZE)) diff --git a/backend/app/views/layouts/marketing_live.html.erb b/backend/app/views/layouts/marketing_live.html.erb index 37f4f5a..2d1eeb4 100644 --- a/backend/app/views/layouts/marketing_live.html.erb +++ b/backend/app/views/layouts/marketing_live.html.erb @@ -6,8 +6,8 @@
La registrazione viene preparata. Riceverai un’email quando sarà pronta.
+Registrazione in elaborazione. Riceverai un’email quando sarà pronta.
-- Durata <%= @recording.duration_label %> - <% if @recording.expires_at %> - · Disponibile fino al <%= l_local(@recording.expires_at) %> - <% end %> - · <%= @recording.publicly_listed? ? "Pubblico" : "Privato (link)" %> - <% if @recording.byte_size.to_i.positive? %> - · <%= @recording.byte_size_label %> - <% end %> -
- <% ent = @recording.team.entitlements %> + <% ent = @recording.team.entitlements %> + <% if (ent.phone_download_enabled? && (logged_in? || @recording.unlisted?)) || @recording.youtube_watch_url %>- Replay disponibile su YouTube (copia server non presente). - <%= link_to "Apri su YouTube", @recording.youtube_watch_url, target: "_blank", rel: "noopener" %> -
+ + <% elsif @recording.ready? %> -Il file video non è più disponibile (archivio rimosso o in migrazione).
-Durata registrata: <%= @recording.duration_label %> · <%= @recording.byte_size_label %>
+Il video non è più sul server (archivio rimosso o in migrazione).
+Replay non disponibile: <%= @recording.error_message.presence || "errore di elaborazione" %>.
+<%= @recording.error_message.presence || "Errore di elaborazione della registrazione." %>
Replay non più disponibile.
+Questa registrazione non è più accessibile.