Aggiunge overlay server-side burn-in e stabilizza diretta live.
Tabellone, badge e brand sono ricodificati nel flusso _air via OverlayRelay; sync punteggio HTTP, volume condiviso rails/sidekiq, qualità 720p migliorata e badge CONNECTING in ripresa da pausa. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
53
backend/app/services/streams/overlay/badge_label.rb
Normal file
53
backend/app/services/streams/overlay/badge_label.rb
Normal file
@@ -0,0 +1,53 @@
|
||||
module Streams
|
||||
module Overlay
|
||||
# Etichetta stato broadcast (stessa logica della pagina live / badge HTML).
|
||||
class BadgeLabel
|
||||
Result = Struct.new(:text, :background, :foreground, keyword_init: true)
|
||||
|
||||
def self.for(session)
|
||||
new(session).call
|
||||
end
|
||||
|
||||
def initialize(session)
|
||||
@session = session
|
||||
end
|
||||
|
||||
def call
|
||||
return Result.new(text: "DIRETTA CHIUSA", background: "#374151", foreground: "#dddddd") if @session.terminal?
|
||||
return Result.new(text: "IN PAUSA", background: "#455a64", foreground: "#ffffff") if @session.paused?
|
||||
|
||||
if publisher_online? || (@session.live? && !@session.paused?)
|
||||
return Result.new(text: "IN ONDA", background: "#2e7d32", foreground: "#ffffff")
|
||||
end
|
||||
|
||||
if path_has_output?
|
||||
if @session.reconnecting?
|
||||
return Result.new(text: "RICONNESSIONE", background: "#f57c00", foreground: "#ffffff")
|
||||
end
|
||||
if @session.connecting?
|
||||
return Result.new(text: "CONNECTING", background: "#f57c00", foreground: "#ffffff")
|
||||
end
|
||||
return Result.new(text: "COPERTINA", background: "#455a64", foreground: "#ffffff")
|
||||
end
|
||||
|
||||
Result.new(text: "IN ATTESA", background: "#455a64", foreground: "#ffffff")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def path_info
|
||||
@path_info ||= Mediamtx::Client.new.list_paths.find { |i| i["name"] == @session.mediamtx_path_name }
|
||||
end
|
||||
|
||||
def publisher_online?
|
||||
info = path_info
|
||||
info && info["online"]
|
||||
end
|
||||
|
||||
def path_has_output?
|
||||
info = path_info
|
||||
info && (info["ready"] || info["available"] || info["online"])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user