diff --git a/backend/app/helpers/public/regia_helper.rb b/backend/app/helpers/public/regia_helper.rb
index 6ac30fb..b88242c 100644
--- a/backend/app/helpers/public/regia_helper.rb
+++ b/backend/app/helpers/public/regia_helper.rb
@@ -52,6 +52,18 @@ module Public
muteError: t("regia.js.mute_error"),
closeError: t("regia.js.close_error"),
closeConfirm: t("regia.js.close_confirm"),
+ pauseConfirmTitle: t("regia.js.pause_confirm_title"),
+ pauseConfirmBody: t("regia.js.pause_confirm_body"),
+ resumeConfirmTitle: t("regia.js.resume_confirm_title"),
+ resumeConfirmBody: t("regia.js.resume_confirm_body"),
+ muteConfirmTitle: t("regia.js.mute_confirm_title"),
+ muteConfirmBody: t("regia.js.mute_confirm_body"),
+ unmuteConfirmTitle: t("regia.js.unmute_confirm_title"),
+ unmuteConfirmBody: t("regia.js.unmute_confirm_body"),
+ advancePeriodTitle: t("regia.js.advance_period_title"),
+ advancePeriodBody: t("regia.js.advance_period_body"),
+ confirmAction: t("regia.modal.confirm_action"),
+ stopConfirmTitle: t("regia.js.stop_confirm_title"),
linkUnavailable: t("regia.js.link_unavailable"),
linkCopied: t("regia.js.link_copied"),
copyPrompt: t("regia.js.copy_prompt"),
diff --git a/backend/app/services/mediamtx/client.rb b/backend/app/services/mediamtx/client.rb
index 533647b..e89bd5a 100644
--- a/backend/app/services/mediamtx/client.rb
+++ b/backend/app/services/mediamtx/client.rb
@@ -74,7 +74,48 @@ module Mediamtx
set_always_available(session, enabled: true)
end
- # Slate alwaysAvailable: copertina sullo stesso path quando il telefono è offline.
+ # Garantisce path config + slate: se MediaMTX ha perso la config (restart → all_others),
+ # in pausa non resterebbe nessuno stream verso HLS/YouTube.
+ def ensure_path_with_slate!(session)
+ path = session.mediamtx_path_name
+ response = @conn.get("/v3/config/paths/get/#{CGI.escape(path)}")
+ missing = response.status == 404 ||
+ (response.body.is_a?(Hash) && response.body["error"].present?)
+
+ if missing
+ forget_always_available(path)
+ begin
+ create_path(session)
+ rescue Error
+ # Path creato in parallelo o già presente: forza solo la slate.
+ forget_always_available(path)
+ set_always_available(session, enabled: true)
+ end
+ return true
+ end
+
+ conf = response.body.is_a?(Hash) ? response.body : {}
+ desired = slate_file_path(session)
+ if conf["alwaysAvailable"] == true && conf["alwaysAvailableFile"].to_s == desired.to_s
+ remember_always_available(path, enabled: true)
+ return true
+ end
+
+ forget_always_available(path)
+ set_always_available(session, enabled: true)
+ end
+
+ # Spegnere record solo se attivo: ogni PATCH path ricarica MediaMTX e distrugge i muxer HLS.
+ def disable_recording_if_active!(session)
+ path = session.mediamtx_path_name
+ response = @conn.get("/v3/config/paths/get/#{CGI.escape(path)}")
+ return true unless response.success?
+ return true unless response.body.is_a?(Hash) && response.body["record"] == true
+
+ set_path_recording(session, enabled: false)
+ end
+
+ # Slate alwaysAvailable: copertina sullo stesso path quando il telefono è offline.
# Resta accesa anche con publisher in onda (MediaMTX usa il publisher se presente).
def set_always_available(session, enabled:)
path = session.mediamtx_path_name
diff --git a/backend/app/services/mediamtx/publisher_sync.rb b/backend/app/services/mediamtx/publisher_sync.rb
index 157fd19..f058ab9 100644
--- a/backend/app/services/mediamtx/publisher_sync.rb
+++ b/backend/app/services/mediamtx/publisher_sync.rb
@@ -79,9 +79,8 @@ module Mediamtx
end
def restore_slate_path!(session)
- return if session.platform == "matchlivetv"
-
- Client.for_session(session).set_always_available(session, enabled: true)
+ # Anche su matchlivetv: dopo restart MediaMTX la path può cadere su all_others senza slate.
+ Client.for_session(session).ensure_path_with_slate!(session)
rescue Client::Error => e
Rails.logger.warn("[PublisherSync] enable slate session=#{session.id}: #{e.message}")
end
@@ -146,6 +145,14 @@ module Mediamtx
nil
end
+ def self.remember_recording_off!(session_id)
+ redis = Redis.new(url: ENV.fetch("REDIS_URL", "redis://localhost:6379/0"))
+ redis.set("mediamtx:recording:#{session_id}", "0", ex: 48.hours.to_i)
+ redis.set(format("mediamtx:recording:patched_at:%s", session_id), Time.current.to_i, ex: 48.hours.to_i)
+ rescue Redis::BaseError
+ nil
+ end
+
def recording_state_key(session_id)
"mediamtx:recording:#{session_id}"
end
diff --git a/backend/app/services/sessions/pause.rb b/backend/app/services/sessions/pause.rb
index ea6e7f6..129bb60 100644
--- a/backend/app/services/sessions/pause.rb
+++ b/backend/app/services/sessions/pause.rb
@@ -7,11 +7,13 @@ module Sessions
def call
cancel_timeout_job
@session.pause! if @session.may_pause?
- Mediamtx::PublisherSync.forget_recording_state!(@session.id)
begin
mtx = Mediamtx::Client.for_session(@session)
- mtx.set_path_recording(@session, enabled: false)
- mtx.set_always_available(@session, enabled: true)
+ # Ricrea/riallinea slate prima di spegnere l'RTMP del telefono.
+ mtx.ensure_path_with_slate!(@session)
+ # PATCH recording solo se era attivo (evita kill muxer HLS a ogni pausa).
+ mtx.disable_recording_if_active!(@session)
+ Mediamtx::PublisherSync.remember_recording_off!(@session.id)
rescue Mediamtx::Client::Error => e
Rails.logger.warn("[Sessions::Pause] MediaMTX: #{e.message}")
end
diff --git a/backend/app/services/streams/cover_slate_paths.rb b/backend/app/services/streams/cover_slate_paths.rb
index dc84398..ff4db1e 100644
--- a/backend/app/services/streams/cover_slate_paths.rb
+++ b/backend/app/services/streams/cover_slate_paths.rb
@@ -4,10 +4,15 @@ module Streams
ENV.fetch("MEDIAMTX_SLATES_CUSTOM_DIR", "/slates/custom")
end
+ # ActiveStorage checksum is base64 e può contenere "/", "+", "=" — non usabile come path.
+ def self.safe_digest(checksum)
+ checksum.to_s.tr("+/", "-_").delete("=")
+ end
+
def self.filename_for(record)
return nil unless record.cover_slate.attached?
- digest = record.cover_slate.blob.checksum
+ digest = safe_digest(record.cover_slate.blob.checksum)
prefix = record.class.name.underscore
"#{prefix}-#{record.id}-#{digest}.mp4"
end
diff --git a/backend/app/services/streams/slate_distributor.rb b/backend/app/services/streams/slate_distributor.rb
index 92911bd..fd1903c 100644
--- a/backend/app/services/streams/slate_distributor.rb
+++ b/backend/app/services/streams/slate_distributor.rb
@@ -31,8 +31,11 @@ module Streams
end
host_path = result.slate_local_path
- filename = File.basename(host_path)
- mediamtx_path = "#{CoverSlatePaths.slates_custom_root}/#{filename}"
+ filename = CoverSlatePaths.filename_for(result.record)
+ raise Error, "slate filename missing" if filename.blank?
+
+ # Path completo (non File.basename): il checksum AS può contenere "/" e spezzerebbe il path.
+ mediamtx_path = CoverSlatePaths.expected_path(result.record)
if cloud_node?
push_to_agent!(filename, result.record, host_path)
diff --git a/backend/app/views/public/live/show.html.erb b/backend/app/views/public/live/show.html.erb
index b26c6f4..82132a5 100644
--- a/backend/app/views/public/live/show.html.erb
+++ b/backend/app/views/public/live/show.html.erb
@@ -219,7 +219,8 @@
}
function onEnterPause() {
- nudgePlayback();
+ // Camera → slate cambia risoluzione/codec: senza reload HLS.js resta spesso bloccato.
+ hardReloadPlayer();
}
function hardReloadPlayer() {
diff --git a/backend/app/views/public/regia/show.html.erb b/backend/app/views/public/regia/show.html.erb
index d22f67f..2f6279c 100644
--- a/backend/app/views/public/regia/show.html.erb
+++ b/backend/app/views/public/regia/show.html.erb
@@ -165,4 +165,4 @@
-
+
diff --git a/backend/config/initializers/match_live_tv.rb b/backend/config/initializers/match_live_tv.rb
index 8e44d60..09fc429 100644
--- a/backend/config/initializers/match_live_tv.rb
+++ b/backend/config/initializers/match_live_tv.rb
@@ -21,7 +21,7 @@ module MatchLiveTv
end
def hls_public_url
- ENV.fetch("HLS_PUBLIC_URL", "http://localhost:8888")
+ ENV.fetch("HLS_PUBLIC_URL") { "#{app_public_url.chomp('/')}/hls" }
end
def mediamtx_hls_url
diff --git a/backend/config/locales/admin.de.yml b/backend/config/locales/admin.de.yml
index 6bd756f..1e03487 100644
--- a/backend/config/locales/admin.de.yml
+++ b/backend/config/locales/admin.de.yml
@@ -57,7 +57,7 @@ de:
username_label: Benutzername
password_label: Passwort
submit: Anmelden
- initial_credentials_html: "Anfangs-Zugangsdaten: admin / admin. Ändere das Passwort nach der ersten Anmeldung."
+ initial_credentials_html: "Anfangs-Zugangsdaten: admin / AdminPass123. Ändere das Passwort nach der ersten Anmeldung."
passwords:
edit:
title: Passwort ändern
diff --git a/backend/config/locales/admin.en.yml b/backend/config/locales/admin.en.yml
index 03df4c2..4ffa86e 100644
--- a/backend/config/locales/admin.en.yml
+++ b/backend/config/locales/admin.en.yml
@@ -57,7 +57,7 @@ en:
username_label: Username
password_label: Password
submit: Log in
- initial_credentials_html: "Initial credentials: admin / admin. Change the password after the first login."
+ initial_credentials_html: "Initial credentials: admin / AdminPass123. Change the password after the first login."
passwords:
edit:
title: Change password
diff --git a/backend/config/locales/admin.es.yml b/backend/config/locales/admin.es.yml
index 99d483a..dccd50c 100644
--- a/backend/config/locales/admin.es.yml
+++ b/backend/config/locales/admin.es.yml
@@ -57,7 +57,7 @@ es:
username_label: Usuario
password_label: Contraseña
submit: Acceder
- initial_credentials_html: "Credenciales iniciales: admin / admin. Cambia la contraseña después del primer acceso."
+ initial_credentials_html: "Credenciales iniciales: admin / AdminPass123. Cambia la contraseña después del primer acceso."
passwords:
edit:
title: Cambiar contraseña
diff --git a/backend/config/locales/admin.fr.yml b/backend/config/locales/admin.fr.yml
index 1952c94..7e1bb69 100644
--- a/backend/config/locales/admin.fr.yml
+++ b/backend/config/locales/admin.fr.yml
@@ -57,7 +57,7 @@ fr:
username_label: Nom d'utilisateur
password_label: Mot de passe
submit: Se connecter
- initial_credentials_html: "Identifiants initiaux : admin / admin. Changez le mot de passe après la première connexion."
+ initial_credentials_html: "Identifiants initiaux : admin / AdminPass123. Changez le mot de passe après la première connexion."
passwords:
edit:
title: Changer le mot de passe
diff --git a/backend/config/locales/admin.it.yml b/backend/config/locales/admin.it.yml
index 75581b0..b5be3f0 100644
--- a/backend/config/locales/admin.it.yml
+++ b/backend/config/locales/admin.it.yml
@@ -61,7 +61,7 @@ it:
username_label: Username
password_label: Password
submit: Accedi
- initial_credentials_html: "Credenziali iniziali: admin / admin. Cambia la password dopo il primo accesso."
+ initial_credentials_html: "Credenziali iniziali: admin / AdminPass123. Cambia la password dopo il primo accesso."
passwords:
edit:
title: Cambia password
diff --git a/backend/config/locales/app.de.yml b/backend/config/locales/app.de.yml
index 56a9578..25cb167 100644
--- a/backend/config/locales/app.de.yml
+++ b/backend/config/locales/app.de.yml
@@ -491,6 +491,7 @@ de:
modal:
set_won_title: Satz gewonnen
confirm: Satz beenden
+ confirm_action: Bestätigen
cancel: Abbrechen
board:
next_period: Nächstes Viertel
@@ -530,6 +531,17 @@ de:
mute_error: Fehler beim Stummschalten
close_error: Fehler beim Beenden
close_confirm: Übertragung endgültig beenden?
+ pause_confirm_title: Livestream pausieren?
+ pause_confirm_body: Das Cover bleibt on air, bis du fortsetzt.
+ resume_confirm_title: Livestream fortsetzen?
+ resume_confirm_body: Die Kamera geht wieder on air statt des Covers.
+ mute_confirm_title: Audio stummschalten?
+ mute_confirm_body: Das Mikrofon wird nicht mehr an den Stream gesendet, bis du es wieder aktivierst.
+ unmute_confirm_title: Audio wieder aktivieren?
+ unmute_confirm_body: Das Mikrofon ist wieder aktiv im Stream.
+ advance_period_title: Zum nächsten Abschnitt wechseln?
+ advance_period_body: Die Anzeigetafel wechselt zum nächsten Abschnitt und der aktuelle Stand wird gespeichert.
+ stop_confirm_title: Livestream beenden?
link_unavailable: Link nicht verfügbar
link_copied: Link kopiert
copy_prompt: "Link kopieren:"
diff --git a/backend/config/locales/app.en.yml b/backend/config/locales/app.en.yml
index d64eab1..9bd8337 100644
--- a/backend/config/locales/app.en.yml
+++ b/backend/config/locales/app.en.yml
@@ -494,6 +494,7 @@ en:
modal:
set_won_title: Set won
confirm: Close set
+ confirm_action: Confirm
cancel: Cancel
board:
next_period: Next quarter
@@ -533,6 +534,17 @@ en:
mute_error: Error muting audio
close_error: Error closing
close_confirm: Permanently close the live stream?
+ pause_confirm_title: Pause the live stream?
+ pause_confirm_body: The cover slate will stay on air until you resume.
+ resume_confirm_title: Resume the live stream?
+ resume_confirm_body: The camera will go back on air instead of the cover slate.
+ mute_confirm_title: Mute audio?
+ mute_confirm_body: The microphone will not be sent to the stream until you unmute.
+ unmute_confirm_title: Unmute audio?
+ unmute_confirm_body: The microphone will be active on the stream again.
+ advance_period_title: Advance to the next period?
+ advance_period_body: The scoreboard will move to the next period and the current period score will be saved.
+ stop_confirm_title: End the live stream?
link_unavailable: Link not available
link_copied: Link copied
copy_prompt: "Copy the link:"
diff --git a/backend/config/locales/app.es.yml b/backend/config/locales/app.es.yml
index 5f8d7c2..f49c574 100644
--- a/backend/config/locales/app.es.yml
+++ b/backend/config/locales/app.es.yml
@@ -491,6 +491,7 @@ es:
modal:
set_won_title: Set ganado
confirm: Cerrar set
+ confirm_action: Confirmar
cancel: Cancelar
board:
next_period: Siguiente cuarto
@@ -530,6 +531,17 @@ es:
mute_error: Error al silenciar el audio
close_error: Error al cerrar
close_confirm: "¿Cerrar definitivamente la retransmisión?"
+ pause_confirm_title: "¿Pausar el directo?"
+ pause_confirm_body: La portada seguirá en antena hasta que lo reanudes.
+ resume_confirm_title: "¿Reanudar el directo?"
+ resume_confirm_body: La cámara volverá a antena en lugar de la portada.
+ mute_confirm_title: "¿Silenciar el audio?"
+ mute_confirm_body: El micrófono no se enviará al stream hasta que lo reactives.
+ unmute_confirm_title: "¿Reactivar el audio?"
+ unmute_confirm_body: El micrófono volverá a estar activo en el stream.
+ advance_period_title: "¿Pasar al periodo siguiente?"
+ advance_period_body: El marcador pasará al siguiente periodo y se guardará el marcador del periodo actual.
+ stop_confirm_title: "¿Terminar el directo?"
link_unavailable: Enlace no disponible
link_copied: Enlace copiado
copy_prompt: "Copia el enlace:"
diff --git a/backend/config/locales/app.fr.yml b/backend/config/locales/app.fr.yml
index 50759c3..ebedbd4 100644
--- a/backend/config/locales/app.fr.yml
+++ b/backend/config/locales/app.fr.yml
@@ -491,6 +491,7 @@ fr:
modal:
set_won_title: Set gagné
confirm: Terminer le set
+ confirm_action: Confirmer
cancel: Annuler
board:
next_period: Quart-temps suivant
@@ -530,6 +531,17 @@ fr:
mute_error: Erreur lors de la coupure audio
close_error: Erreur de clôture
close_confirm: Clôturer définitivement le direct ?
+ pause_confirm_title: Mettre le direct en pause ?
+ pause_confirm_body: La couverture restera à l'antenne jusqu'à la reprise.
+ resume_confirm_title: Reprendre le direct ?
+ resume_confirm_body: La caméra reviendra à l'antenne à la place de la couverture.
+ mute_confirm_title: Couper l'audio ?
+ mute_confirm_body: Le micro ne sera plus envoyé au flux tant que vous ne le réactivez pas.
+ unmute_confirm_title: Réactiver l'audio ?
+ unmute_confirm_body: Le micro sera à nouveau actif sur le flux.
+ advance_period_title: Passer à la période suivante ?
+ advance_period_body: Le tableau passera à la période suivante et le score de la période en cours sera enregistré.
+ stop_confirm_title: Terminer le direct ?
link_unavailable: Lien non disponible
link_copied: Lien copié
copy_prompt: "Copiez le lien :"
diff --git a/backend/config/locales/app.it.yml b/backend/config/locales/app.it.yml
index cc6d458..d8c5220 100644
--- a/backend/config/locales/app.it.yml
+++ b/backend/config/locales/app.it.yml
@@ -515,6 +515,7 @@ it:
modal:
set_won_title: Set vinto
confirm: Chiudi set
+ confirm_action: Conferma
cancel: Annulla
board:
next_period: Prossimo quarto
@@ -554,6 +555,17 @@ it:
mute_error: Errore silenziamento audio
close_error: Errore chiusura
close_confirm: Chiudere definitivamente la diretta?
+ pause_confirm_title: Mettere in pausa?
+ pause_confirm_body: La diretta passerà alla copertina finché non la riprendi.
+ resume_confirm_title: Riprendere la diretta?
+ resume_confirm_body: La telecamera tornerà in onda al posto della copertina.
+ mute_confirm_title: Silenziare l'audio?
+ mute_confirm_body: Il microfono non verrà inviato allo stream finché non lo riattivi.
+ unmute_confirm_title: Riattivare l'audio?
+ unmute_confirm_body: Il microfono tornerà attivo sullo stream.
+ advance_period_title: Passare al periodo successivo?
+ advance_period_body: Il tabellone passerà al periodo successivo e il punteggio del periodo corrente sarà salvato.
+ stop_confirm_title: Terminare la diretta?
link_unavailable: Link non disponibile
link_copied: Link copiato
copy_prompt: "Copia il link:"
diff --git a/backend/public/regia.js b/backend/public/regia.js
index bd89b21..7808f80 100644
--- a/backend/public/regia.js
+++ b/backend/public/regia.js
@@ -33,6 +33,18 @@
muteError: "Errore silenziamento audio",
closeError: "Errore chiusura",
closeConfirm: "Chiudere definitivamente la diretta?",
+ pauseConfirmTitle: "Mettere in pausa?",
+ pauseConfirmBody: "La diretta passerà alla copertina finché non la riprendi.",
+ resumeConfirmTitle: "Riprendere la diretta?",
+ resumeConfirmBody: "La telecamera tornerà in onda al posto della copertina.",
+ muteConfirmTitle: "Silenziare l'audio?",
+ muteConfirmBody: "Il microfono non verrà inviato allo stream finché non lo riattivi.",
+ unmuteConfirmTitle: "Riattivare l'audio?",
+ unmuteConfirmBody: "Il microfono tornerà attivo sullo stream.",
+ advancePeriodTitle: "Passare al periodo successivo?",
+ advancePeriodBody: "Il tabellone passerà al periodo successivo e il punteggio del periodo corrente sarà salvato.",
+ confirmAction: "Conferma",
+ stopConfirmTitle: "Terminare la diretta?",
linkUnavailable: "Link non disponibile",
linkCopied: "Link copiato",
copyPrompt: "Copia il link:",
@@ -389,13 +401,18 @@
if (cfg.board === "volley" || cfg.board === "racket") {
if (data.set_won && action !== "close_set") {
const winner = data.winner === "home" ? cfg.homeName : cfg.awayName;
- openModal(I18N.setWonTitle, fillTemplate(I18N.setWonBodyTemplate, { winner }), () => postScore("close_set"));
+ openModal(I18N.setWonTitle, fillTemplate(I18N.setWonBodyTemplate, { winner }), () => postScore("close_set"), I18N.closeSetTitle);
}
}
- if (data.match_won) {
- const winner = data.winner === "home" ? cfg.homeName : cfg.awayName;
- openModal(I18N.matchWonTitle, fillTemplate(I18N.matchWonBodyTemplate, { winner }), () => stopStream());
- }
+ if (data.match_won) {
+ const winner = data.winner === "home" ? cfg.homeName : cfg.awayName;
+ openModal(
+ I18N.matchWonTitle,
+ fillTemplate(I18N.matchWonBodyTemplate, { winner }),
+ () => performStopStream(),
+ I18N.confirmAction
+ );
+ }
} catch (e) {
if (prevHome != null && els.homePoints) els.homePoints.textContent = prevHome;
const awayEl = document.getElementById("away-points");
@@ -406,9 +423,12 @@
}
}
- function openModal(title, body, onConfirm) {
+ function openModal(title, body, onConfirm, confirmLabel) {
els.modalTitle.textContent = title;
els.modalBody.textContent = body;
+ if (els.modalConfirm) {
+ els.modalConfirm.textContent = confirmLabel || I18N.confirmAction;
+ }
els.modal.classList.add("open");
pendingAction = onConfirm;
}
@@ -440,7 +460,9 @@
btn.addEventListener("click", () => {
const action = btn.dataset.action;
if (action === "close_set") {
- openModal(I18N.closeSetTitle, I18N.closeSetConfirm, () => postScore("close_set"));
+ openModal(I18N.closeSetTitle, I18N.closeSetConfirm, () => postScore("close_set"), I18N.closeSetTitle);
+ } else if (action === "advance_period") {
+ openModal(I18N.advancePeriodTitle, I18N.advancePeriodBody, () => handleAction("advance_period"));
} else {
handleAction(action);
}
@@ -689,9 +711,8 @@
toast(audioMuted ? I18N.muted : I18N.unmuted);
}
- async function stopStream() {
- const ok = confirm(I18N.closeConfirm);
- if (!ok) return null;
+ async function performStopStream() {
+ if (!cfg.stopUrl) return null;
const res = await fetch(cfg.stopUrl, { method: "POST", headers: { Accept: "application/json" } });
if (!res.ok) throw new Error(I18N.closeError);
const data = await res.json();
@@ -701,9 +722,47 @@
return data;
}
- els.btnPause?.addEventListener("click", () => togglePauseStream().catch((e) => toast(e.message)));
- els.btnAudioMute?.addEventListener("click", () => toggleMuteAudio().catch((e) => toast(e.message)));
- document.getElementById("btn-stop")?.addEventListener("click", () => stopStream().catch((e) => toast(e.message)));
+ function requestStopStream() {
+ openModal(I18N.stopConfirmTitle, I18N.closeConfirm, () => performStopStream(), I18N.confirmAction);
+ }
+
+ function requestPauseToggle() {
+ if (streamPaused) {
+ openModal(I18N.resumeConfirmTitle, I18N.resumeConfirmBody, async () => {
+ await togglePauseStream();
+ return null;
+ });
+ } else {
+ openModal(I18N.pauseConfirmTitle, I18N.pauseConfirmBody, async () => {
+ await togglePauseStream();
+ return null;
+ });
+ }
+ }
+
+ function requestMuteToggle() {
+ if (audioMuted) {
+ openModal(I18N.unmuteConfirmTitle, I18N.unmuteConfirmBody, async () => {
+ await toggleMuteAudio();
+ return null;
+ });
+ } else {
+ openModal(I18N.muteConfirmTitle, I18N.muteConfirmBody, async () => {
+ await toggleMuteAudio();
+ return null;
+ });
+ }
+ }
+
+ async function stopStream() {
+ // Compatibilità: conferma via modal (non window.confirm).
+ requestStopStream();
+ return null;
+ }
+
+ els.btnPause?.addEventListener("click", () => requestPauseToggle());
+ els.btnAudioMute?.addEventListener("click", () => requestMuteToggle());
+ document.getElementById("btn-stop")?.addEventListener("click", () => requestStopStream());
let minQualityBusy = false;
diff --git a/backend/spec/services/mediamtx/publisher_sync_spec.rb b/backend/spec/services/mediamtx/publisher_sync_spec.rb
index 2a5286b..538ae13 100644
--- a/backend/spec/services/mediamtx/publisher_sync_spec.rb
+++ b/backend/spec/services/mediamtx/publisher_sync_spec.rb
@@ -27,6 +27,8 @@ RSpec.describe Mediamtx::PublisherSync do
allow(Mediamtx::PublisherOnline).to receive(:active?).and_return(true)
allow_any_instance_of(described_class).to receive(:redis).and_return(redis)
allow(client).to receive(:set_path_recording)
+ allow(client).to receive(:ensure_path_with_slate!)
+ allow(client).to receive(:set_always_available)
end
it "abilita la registrazione quando il publisher è online e la sessione è live" do
diff --git a/backend/spec/services/streams/slate_distributor_spec.rb b/backend/spec/services/streams/slate_distributor_spec.rb
index c9cf071..3d70949 100644
--- a/backend/spec/services/streams/slate_distributor_spec.rb
+++ b/backend/spec/services/streams/slate_distributor_spec.rb
@@ -43,7 +43,7 @@ RSpec.describe Streams::SlateDistributor do
it "usa path custom su nodo home quando la slate è su disco" do
attach_ready_cover(club)
- custom = "/slates/custom/#{File.basename(Streams::CoverSlatePaths.expected_path(club))}"
+ custom = Streams::CoverSlatePaths.expected_path(club)
expect(described_class.slate_path_for_session(session)).to eq(custom)
end
@@ -72,9 +72,8 @@ RSpec.describe Streams::SlateDistributor do
allow(http).to receive(:read_timeout=)
allow(http).to receive(:request).and_return(response)
- filename = File.basename(Streams::CoverSlatePaths.expected_path(club))
path = described_class.slate_path_for_session(session)
- expect(path).to eq("/slates/custom/#{filename}")
+ expect(path).to eq(Streams::CoverSlatePaths.expected_path(club))
expect(http).to have_received(:request)
end
end
diff --git a/infra/docker-compose.prod.yml b/infra/docker-compose.prod.yml
index 7164e42..687fae7 100644
--- a/infra/docker-compose.prod.yml
+++ b/infra/docker-compose.prod.yml
@@ -99,7 +99,7 @@ services:
HCLOUD_SSH_KEY: ${HCLOUD_SSH_KEY:-matchlivetv-stream-hetzner}
HCLOUD_NETWORK_ID: ${HCLOUD_NETWORK_ID:-}
HCLOUD_USER_DATA_FILE: /opt/matchlivetv/infra/stream-node/cloud-init.yaml
- HLS_PUBLIC_URL: ${HLS_PUBLIC_URL:-http://localhost:8888}
+ HLS_PUBLIC_URL: ${HLS_PUBLIC_URL:-http://localhost:3000/hls}
APP_PUBLIC_URL: ${APP_PUBLIC_URL:-http://localhost:3000}
PRIVACY_CONTACT_EMAIL: ${PRIVACY_CONTACT_EMAIL:-privacy@matchlivetv.it}
SUPPORT_CONTACT_EMAIL: ${SUPPORT_CONTACT_EMAIL:-}
@@ -170,6 +170,7 @@ services:
- ${MATCHLIVETV_VIDEOS_ROOT:-/media/videos/matchlivetv}/recordings:/recordings
- ${MATCHLIVETV_VIDEOS_ROOT:-/media/videos/matchlivetv}/active_storage:/app/storage
- ${MATCHLIVETV_VIDEOS_ROOT:-/media/videos/matchlivetv}/log:/app/log
+ - ./slates:/slates
- ${HCLOUD_USER_DATA_HOST_DIR:-./stream-node}:/opt/matchlivetv/infra/stream-node:ro
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:3000/up"]
@@ -250,7 +251,7 @@ services:
RAILS_INTERNAL_URL: http://rails:3000
MEDIAMTX_HLS_URL: http://mediamtx:8888
MEDIAMTX_INTERNAL_RTMP_URL: rtmp://mediamtx:1935
- HLS_PUBLIC_URL: ${HLS_PUBLIC_URL:-http://localhost:8888}
+ HLS_PUBLIC_URL: ${HLS_PUBLIC_URL:-http://localhost:3000/hls}
APP_PUBLIC_URL: ${APP_PUBLIC_URL:-http://localhost:3000}
MAILER_FROM: ${MAILER_FROM:-Match Live TV }
SMTP_ADDRESS: ${SMTP_ADDRESS:-}
diff --git a/infra/docker-compose.yml b/infra/docker-compose.yml
index bf7b35b..fdf67c5 100644
--- a/infra/docker-compose.yml
+++ b/infra/docker-compose.yml
@@ -160,6 +160,7 @@ services:
- ../backend:/app
- recordings:/recordings
- bundle_cache:/usr/local/bundle
+ - ./slates:/slates
- ./stream-node:/opt/matchlivetv/infra/stream-node:ro
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/up"]
diff --git a/native/android/app/src/androidTest/kotlin/com/matchlivetv/match_live_tv/E2ECoverUploadTest.kt b/native/android/app/src/androidTest/kotlin/com/matchlivetv/match_live_tv/E2ECoverUploadTest.kt
new file mode 100644
index 0000000..e0b7ec8
--- /dev/null
+++ b/native/android/app/src/androidTest/kotlin/com/matchlivetv/match_live_tv/E2ECoverUploadTest.kt
@@ -0,0 +1,308 @@
+package com.matchlivetv.match_live_tv
+
+import android.content.Intent
+import android.os.SystemClock
+import android.view.KeyEvent
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.uiautomator.By
+import androidx.test.uiautomator.UiDevice
+import androidx.test.uiautomator.UiObject2
+import androidx.test.uiautomator.Until
+import org.junit.Assert.assertNotNull
+import org.junit.Assert.assertTrue
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+
+/**
+ * E2E emulatore: login → wizard partita → upload copertina sponsor → salva.
+ * Richiede backend locale su http://10.0.2.2:3000 (variante collaudoDebug).
+ */
+@RunWith(AndroidJUnit4::class)
+class E2ECoverUploadTest {
+ private lateinit var device: UiDevice
+ private val ctx by lazy { InstrumentationRegistry.getInstrumentation().targetContext }
+ private val pkg by lazy { ctx.packageName }
+
+ private fun s(id: Int): String = ctx.getString(id)
+ private fun su(id: Int): String = s(id).uppercase()
+
+ @Before
+ fun setUp() {
+ device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
+ grantRuntimePermissions()
+ launchApp()
+ }
+
+ @Test
+ fun wizard_uploadsMatchCover_andShowsMatchSource() {
+ loginIfNeeded()
+ waitForAnyText(su(R.string.matches_new), "NUOVA PARTITA", "NEW MATCH", timeoutMs = 60_000)
+
+ openMatchWizardViaQuickStart()
+
+ waitForText(s(R.string.wizard_step_title_match), timeoutMs = 45_000)
+ scrollUntilVisible(s(R.string.wizard_match_cover_title))
+
+ tapClickableText(s(R.string.wizard_match_cover_change))
+ pickFirstPhotoFromPicker()
+
+ waitForTextContains(
+ s(R.string.wizard_match_cover_source_match),
+ "Questa partita",
+ "This match",
+ timeoutMs = 20_000,
+ )
+
+ tapClickableText(s(R.string.wizard_action_next))
+ waitForText(s(R.string.wizard_step_title_transmission), timeoutMs = 45_000)
+
+ assertTrue(
+ "Wizard non ha salvato la copertina (step trasmissione non raggiunto)",
+ device.hasObject(By.text(s(R.string.wizard_step_title_transmission))),
+ )
+ }
+
+ private fun waitForTextContains(vararg needles: String, timeoutMs: Long) {
+ val deadline = SystemClock.elapsedRealtime() + timeoutMs
+ while (SystemClock.elapsedRealtime() < deadline) {
+ for (needle in needles) {
+ if (device.hasObject(By.textContains(needle))) return
+ }
+ SystemClock.sleep(250)
+ }
+ error("Nessun testo contenente: ${needles.joinToString()}")
+ }
+
+ private fun loginIfNeeded() {
+ waitForAnyText(
+ s(R.string.login_email),
+ su(R.string.login_submit),
+ su(R.string.matches_new),
+ timeoutMs = 45_000,
+ )
+ if (hasMatchList()) return
+
+ val email = InstrumentationRegistry.getArguments().getString("email") ?: "dir@test.com"
+ val password = InstrumentationRegistry.getArguments().getString("password") ?: "TestPass123!"
+
+ repeat(3) {
+ val emailField = waitForRes("login_email")
+ val passwordField = waitForRes("login_password")
+ pasteIntoField(emailField, email)
+ pasteIntoField(passwordField, password)
+ device.pressKeyCode(KeyEvent.KEYCODE_ENTER)
+ device.waitForIdle()
+ SystemClock.sleep(1500)
+ tapLoginSubmit()
+ SystemClock.sleep(4000)
+ if (hasMatchList()) return
+ }
+ error("Login fallito")
+ }
+
+ private fun openMatchWizardViaQuickStart() {
+ tapClickableText(su(R.string.matches_new))
+ waitForText(s(R.string.sheet_quick_option), timeoutMs = 15_000)
+ tapClickableText(s(R.string.sheet_quick_option))
+ }
+
+ private fun pickFirstPhotoFromPicker() {
+ val pickerPkg = "com.google.android.photopicker"
+ val deadline = SystemClock.elapsedRealtime() + 25_000
+ while (SystemClock.elapsedRealtime() < deadline) {
+ if (device.hasObject(By.pkg(pickerPkg))) break
+ SystemClock.sleep(400)
+ }
+ if (!device.hasObject(By.pkg(pickerPkg))) {
+ error("Photo picker non aperto")
+ }
+
+ SystemClock.sleep(1500)
+
+ if (device.hasObject(By.textContains("cover_test"))) {
+ tapClickableTextContains("cover_test")
+ } else {
+ val thumb = device.findObjects(By.pkg(pickerPkg).clickable(true))
+ .filter {
+ val b = it.visibleBounds
+ b.top >= 1200 && b.width() >= 250
+ }
+ .minByOrNull { it.visibleBounds.top }
+ if (thumb != null) {
+ thumb.click()
+ } else {
+ device.click(device.displayWidth / 6, 1450)
+ }
+ }
+ device.waitForIdle()
+ SystemClock.sleep(1000)
+
+ if (device.hasObject(By.text("Fine"))) {
+ tapClickableText("Fine")
+ } else if (device.hasObject(By.text("Done"))) {
+ tapClickableText("Done")
+ } else {
+ device.click((device.displayWidth * 0.85).toInt(), (device.displayHeight * 0.92).toInt())
+ }
+ waitForWizardReturn()
+ }
+
+ private fun waitForWizardReturn() {
+ device.wait(Until.hasObject(By.pkg(pkg)), 15_000)
+ device.waitForIdle()
+ SystemClock.sleep(800)
+ confirmPickerIfNeeded()
+ }
+
+ private fun tapClickableTextContains(needle: String) {
+ val label = device.findObject(By.textContains(needle))
+ ?: error("Testo non trovato: $needle")
+ var node: UiObject2? = label
+ repeat(8) {
+ val current = node ?: return@repeat
+ if (current.isClickable) {
+ current.click()
+ device.waitForIdle()
+ return
+ }
+ node = current.parent
+ }
+ label.click()
+ device.waitForIdle()
+ }
+
+ private fun confirmPickerIfNeeded() {
+ val confirmLabels = listOf("Done", "Fatto", "OK", "Select", "Seleziona")
+ for (label in confirmLabels) {
+ val btn = device.findObject(By.text(label).clickable(true))
+ if (btn != null) {
+ btn.click()
+ device.waitForIdle()
+ return
+ }
+ }
+ }
+
+ private fun scrollUntilVisible(text: String) {
+ repeat(8) {
+ if (device.hasObject(By.text(text))) return
+ scrollDown(1)
+ }
+ waitForText(text, timeoutMs = 10_000)
+ }
+
+ private fun grantRuntimePermissions() {
+ listOf(
+ "android.permission.CAMERA",
+ "android.permission.RECORD_AUDIO",
+ "android.permission.POST_NOTIFICATIONS",
+ "android.permission.READ_MEDIA_IMAGES",
+ "android.permission.READ_EXTERNAL_STORAGE",
+ ).forEach { permission ->
+ device.executeShellCommand("pm grant $pkg $permission")
+ }
+ }
+
+ private fun launchApp() {
+ val intent = ctx.packageManager.getLaunchIntentForPackage(pkg)?.apply {
+ addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK)
+ } ?: error("Launch intent mancante per $pkg")
+ ctx.startActivity(intent)
+ device.wait(Until.hasObject(By.pkg(pkg).depth(0)), 15_000)
+ }
+
+ private fun hasMatchList(): Boolean =
+ device.hasObject(By.text(su(R.string.matches_new))) ||
+ device.hasObject(By.text("NUOVA PARTITA")) ||
+ device.hasObject(By.text("NEW MATCH"))
+
+ private fun waitForRes(tag: String): UiObject2 {
+ val obj = device.wait(Until.findObject(By.res(tag)), 10_000)
+ ?: device.wait(Until.findObject(By.res("$pkg:id/$tag")), 2_000)
+ ?: error("Nodo non trovato: $tag")
+ return obj
+ }
+
+ private fun tapLoginSubmit() {
+ val btn = device.wait(Until.findObject(By.res("login_submit")), 3_000)
+ ?: device.wait(Until.findObject(By.res("$pkg:id/login_submit")), 1_000)
+ if (btn != null) {
+ val bounds = btn.visibleBounds
+ device.click(bounds.centerX(), bounds.centerY())
+ device.waitForIdle()
+ return
+ }
+ val nodes = device.findObjects(By.text(su(R.string.login_submit))) +
+ device.findObjects(By.text("ACCEDI")) +
+ device.findObjects(By.text("LOG IN"))
+ val target = nodes.lastOrNull { it.isClickable } ?: nodes.lastOrNull()
+ target?.click()
+ device.waitForIdle()
+ }
+
+ private fun pasteIntoField(field: UiObject2, value: String) {
+ field.click()
+ device.waitForIdle()
+ field.clear()
+ field.text = value
+ device.waitForIdle()
+ }
+
+ private fun waitForText(text: String, timeoutMs: Long): UiObject2 {
+ val obj = device.wait(Until.findObject(By.text(text)), timeoutMs)
+ assertNotNull("Testo non trovato entro ${timeoutMs}ms: $text", obj)
+ return obj!!
+ }
+
+ private fun waitForAnyText(vararg texts: String, timeoutMs: Long) {
+ val deadline = SystemClock.elapsedRealtime() + timeoutMs
+ while (SystemClock.elapsedRealtime() < deadline) {
+ for (text in texts) {
+ if (device.hasObject(By.text(text))) return
+ }
+ SystemClock.sleep(250)
+ }
+ error("Nessuno dei testi trovato: ${texts.joinToString()}")
+ }
+
+ private fun tapClickableText(text: String) {
+ repeat(8) {
+ val clickable = device.findObject(By.text(text).clickable(true))
+ val label = clickable ?: device.findObject(By.text(text))
+ if (label != null) {
+ val b = label.visibleBounds
+ if (b.height() >= 16 && b.bottom <= device.displayHeight && b.top >= 0) {
+ var node: UiObject2? = label
+ for (i in 0 until 6) {
+ val current = node ?: break
+ if (current.isClickable) {
+ current.click()
+ device.waitForIdle()
+ return
+ }
+ node = current.parent
+ }
+ label.click()
+ device.waitForIdle()
+ return
+ }
+ }
+ scrollDown(1)
+ device.waitForIdle()
+ }
+ error("Testo non cliccabile visibile: $text")
+ }
+
+ private fun scrollDown(steps: Int = 2) {
+ val centerX = device.displayWidth / 2
+ val startY = (device.displayHeight * 0.75).toInt()
+ val endY = (device.displayHeight * 0.25).toInt()
+ repeat(steps) {
+ device.swipe(centerX, startY, centerX, endY, 24)
+ device.waitForIdle()
+ SystemClock.sleep(300)
+ }
+ }
+}
diff --git a/native/android/app/src/androidTest/kotlin/com/matchlivetv/match_live_tv/E2ESideConfirmDialogTest.kt b/native/android/app/src/androidTest/kotlin/com/matchlivetv/match_live_tv/E2ESideConfirmDialogTest.kt
new file mode 100644
index 0000000..60c71ba
--- /dev/null
+++ b/native/android/app/src/androidTest/kotlin/com/matchlivetv/match_live_tv/E2ESideConfirmDialogTest.kt
@@ -0,0 +1,258 @@
+package com.matchlivetv.match_live_tv
+
+import android.content.Intent
+import android.os.SystemClock
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.uiautomator.By
+import androidx.test.uiautomator.UiDevice
+import androidx.test.uiautomator.UiObject2
+import androidx.test.uiautomator.Until
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertTrue
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+
+/**
+ * E2E: in diretta, ogni tasto laterale critico apre un dialog di conferma
+ * e Annulla non esegue l'azione.
+ */
+@RunWith(AndroidJUnit4::class)
+class E2ESideConfirmDialogTest {
+ private lateinit var device: UiDevice
+ private val ctx by lazy { InstrumentationRegistry.getInstrumentation().targetContext }
+ private val pkg by lazy { ctx.packageName }
+
+ private fun s(id: Int): String = ctx.getString(id)
+ private fun su(id: Int): String = s(id).uppercase()
+
+ @Before
+ fun setUp() {
+ device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
+ grantRuntimePermissions()
+ launchApp()
+ }
+
+ @Test
+ fun sideButtons_showConfirmDialog_andCancel() {
+ ensureLoggedIn()
+ openMatchWizardViaQuickStart()
+ waitForText(s(R.string.wizard_step_title_match), timeoutMs = 45_000)
+ scrollDown()
+ tapClickableText(s(R.string.wizard_action_next))
+ waitForText(s(R.string.wizard_step_title_transmission), timeoutMs = 45_000)
+ skipToNetworkAndStart()
+
+ waitForAnyText(
+ s(R.string.broadcast_status_live),
+ s(R.string.broadcast_status_connecting),
+ s(R.string.broadcast_status_paused),
+ timeoutMs = 90_000,
+ )
+ SystemClock.sleep(2_000)
+
+ assertConfirmThenCancel(
+ contentDesc = s(R.string.broadcast_pause_cd),
+ dialogTitle = s(R.string.broadcast_pause_title),
+ )
+ assertConfirmThenCancel(
+ contentDesc = s(R.string.broadcast_mute_cd),
+ dialogTitle = s(R.string.broadcast_mute_title),
+ )
+ assertConfirmThenCancel(
+ contentDesc = s(R.string.broadcast_share_regia_cd),
+ dialogTitle = s(R.string.broadcast_share_regia_title),
+ )
+ assertConfirmThenCancel(
+ contentDesc = s(R.string.broadcast_terminate_cd),
+ dialogTitle = s(R.string.broadcast_terminate_title),
+ )
+
+ // Dopo Annulla su termina, la diretta deve essere ancora aperta.
+ assertTrue(
+ "La diretta non deve chiudersi dopo Annulla su termina",
+ device.hasObject(By.desc(s(R.string.broadcast_pause_cd))) ||
+ device.hasObject(By.desc(s(R.string.broadcast_resume_cd))) ||
+ device.hasObject(By.text(s(R.string.broadcast_status_live))) ||
+ device.hasObject(By.text(s(R.string.broadcast_status_connecting))) ||
+ device.hasObject(By.text(s(R.string.broadcast_status_paused))),
+ )
+ }
+
+ private fun assertConfirmThenCancel(contentDesc: String, dialogTitle: String) {
+ val btn = device.wait(Until.findObject(By.desc(contentDesc)), 15_000)
+ ?: error("Pulsante laterale non trovato: $contentDesc")
+ btn.click()
+ device.waitForIdle()
+ val title = device.wait(Until.findObject(By.text(dialogTitle)), 8_000)
+ assertTrue("Dialog conferma assente per $contentDesc (atteso: $dialogTitle)", title != null)
+ tapClickableText(s(R.string.action_cancel))
+ SystemClock.sleep(600)
+ assertFalse(
+ "Dialog ancora aperto dopo Annulla: $dialogTitle",
+ device.hasObject(By.text(dialogTitle)),
+ )
+ }
+
+ private fun skipToNetworkAndStart() {
+ val onNetworkStep = {
+ device.hasObject(By.text(s(R.string.wizard_network_test_start_label))) ||
+ device.hasObject(By.text("AVVIA TEST RETE"))
+ }
+ repeat(5) {
+ if (onNetworkStep()) return@repeat
+ runCatching { tapClickableText(s(R.string.wizard_action_next)) }
+ scrollUp()
+ SystemClock.sleep(800)
+ }
+ waitForAnyText(s(R.string.wizard_network_test_start_label), "AVVIA TEST RETE", timeoutMs = 45_000)
+ tapClickableText(s(R.string.wizard_network_test_start_label))
+ waitForText(s(R.string.wizard_action_start), timeoutMs = 45_000)
+ waitUntilEnabled(s(R.string.wizard_action_start), timeoutMs = 30_000)
+ tapClickableText(s(R.string.wizard_action_start))
+ }
+
+ private fun ensureLoggedIn() {
+ waitForAnyText(
+ s(R.string.login_email),
+ su(R.string.login_submit),
+ su(R.string.matches_new),
+ timeoutMs = 45_000,
+ )
+ if (hasMatchList()) return
+ fillLogin()
+ tapLoginSubmit()
+ SystemClock.sleep(3_000)
+ waitForAnyText(su(R.string.matches_new), timeoutMs = 60_000)
+ }
+
+ private fun fillLogin() {
+ val email = device.findObject(By.clazz("android.widget.EditText"))
+ ?: error("Campo email non trovato")
+ pasteIntoField(email, "dir@test.com")
+ val fields = device.findObjects(By.clazz("android.widget.EditText"))
+ val password = fields.getOrNull(1) ?: error("Campo password non trovato")
+ pasteIntoField(password, "TestPass123!")
+ }
+
+ private fun tapLoginSubmit() {
+ tapClickableText(su(R.string.login_submit))
+ }
+
+ private fun openMatchWizardViaQuickStart() {
+ tapClickableText(su(R.string.matches_new))
+ waitForText(s(R.string.sheet_quick_option), timeoutMs = 15_000)
+ tapClickableText(s(R.string.sheet_quick_option))
+ }
+
+ private fun grantRuntimePermissions() {
+ listOf(
+ "android.permission.CAMERA",
+ "android.permission.RECORD_AUDIO",
+ "android.permission.POST_NOTIFICATIONS",
+ ).forEach { permission ->
+ device.executeShellCommand("pm grant $pkg $permission")
+ }
+ }
+
+ private fun launchApp() {
+ val intent = ctx.packageManager.getLaunchIntentForPackage(pkg)?.apply {
+ addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK)
+ } ?: error("Launch intent mancante per $pkg")
+ ctx.startActivity(intent)
+ device.wait(Until.hasObject(By.pkg(pkg).depth(0)), 15_000)
+ }
+
+ private fun hasMatchList(): Boolean =
+ device.hasObject(By.text(su(R.string.matches_new)))
+
+ private fun pasteIntoField(field: UiObject2, value: String) {
+ field.click()
+ device.waitForIdle()
+ field.clear()
+ field.text = value
+ device.waitForIdle()
+ }
+
+ private fun waitForText(text: String, timeoutMs: Long): UiObject2 {
+ val obj = device.wait(Until.findObject(By.text(text)), timeoutMs)
+ ?: error("Testo non trovato entro ${timeoutMs}ms: $text")
+ return obj
+ }
+
+ private fun waitForAnyText(vararg texts: String, timeoutMs: Long) {
+ val deadline = SystemClock.elapsedRealtime() + timeoutMs
+ while (SystemClock.elapsedRealtime() < deadline) {
+ for (text in texts) {
+ if (device.hasObject(By.text(text))) return
+ }
+ SystemClock.sleep(250)
+ }
+ error("Nessuno dei testi trovato: ${texts.joinToString()}")
+ }
+
+ private fun tapClickableText(text: String) {
+ repeat(6) {
+ val clickable = device.findObject(By.text(text).clickable(true))
+ val label = clickable ?: device.findObject(By.text(text))
+ if (label != null) {
+ var node: UiObject2? = label
+ for (i in 0 until 6) {
+ val current = node ?: break
+ if (current.isClickable) {
+ current.click()
+ device.waitForIdle()
+ return
+ }
+ node = current.parent
+ }
+ label.click()
+ device.waitForIdle()
+ return
+ }
+ scrollDown(1)
+ device.waitForIdle()
+ }
+ error("Testo non cliccabile visibile: $text")
+ }
+
+ private fun waitUntilEnabled(text: String, timeoutMs: Long) {
+ val deadline = SystemClock.elapsedRealtime() + timeoutMs
+ while (SystemClock.elapsedRealtime() < deadline) {
+ val label = device.findObject(By.text(text))
+ if (label != null) {
+ var node: UiObject2? = label
+ for (i in 0 until 6) {
+ val current = node ?: break
+ if (current.isClickable && current.isEnabled) return
+ node = current.parent
+ }
+ }
+ SystemClock.sleep(500)
+ }
+ error("Pulsante non abilitato entro timeout: $text")
+ }
+
+ private fun scrollDown(steps: Int = 2) {
+ val centerX = device.displayWidth / 2
+ val startY = (device.displayHeight * 0.75).toInt()
+ val endY = (device.displayHeight * 0.25).toInt()
+ repeat(steps) {
+ device.swipe(centerX, startY, centerX, endY, 24)
+ device.waitForIdle()
+ SystemClock.sleep(300)
+ }
+ }
+
+ private fun scrollUp(steps: Int = 1) {
+ val centerX = device.displayWidth / 2
+ val startY = (device.displayHeight * 0.35).toInt()
+ val endY = (device.displayHeight * 0.75).toInt()
+ repeat(steps) {
+ device.swipe(centerX, startY, centerX, endY, 24)
+ device.waitForIdle()
+ SystemClock.sleep(300)
+ }
+ }
+}
diff --git a/native/android/app/src/main/kotlin/com/matchlivetv/match_live_tv/ui/broadcast/BroadcastControlsOverlay.kt b/native/android/app/src/main/kotlin/com/matchlivetv/match_live_tv/ui/broadcast/BroadcastControlsOverlay.kt
index ffcfe67..63a9910 100644
--- a/native/android/app/src/main/kotlin/com/matchlivetv/match_live_tv/ui/broadcast/BroadcastControlsOverlay.kt
+++ b/native/android/app/src/main/kotlin/com/matchlivetv/match_live_tv/ui/broadcast/BroadcastControlsOverlay.kt
@@ -123,7 +123,7 @@ fun BroadcastControlsOverlay(
onSelectMinQuality: (String) -> Unit = {},
modifier: Modifier = Modifier,
) {
- var showTerminateConfirm by remember { mutableStateOf(false) }
+ var pendingConfirm by remember { mutableStateOf(null) }
var showMinQualityPicker by remember { mutableStateOf(false) }
val autoLabel = stringResource(R.string.broadcast_min_quality_auto)
@@ -140,25 +140,21 @@ fun BroadcastControlsOverlay(
)
}
- if (showTerminateConfirm) {
- AlertDialog(
- onDismissRequest = { showTerminateConfirm = false },
- containerColor = MatchColors.SurfaceElevated,
- title = { Text(stringResource(R.string.broadcast_terminate_title)) },
- text = { Text(stringResource(R.string.broadcast_terminate_message)) },
- confirmButton = {
- TextButton(
- onClick = {
- showTerminateConfirm = false
- onTerminate()
- },
- ) {
- Text(stringResource(R.string.broadcast_terminate_confirm), color = MatchColors.PrimaryRed)
- }
- },
- dismissButton = {
- TextButton(onClick = { showTerminateConfirm = false }) {
- Text(stringResource(R.string.action_cancel), color = MatchColors.TextSecondary)
+ pendingConfirm?.let { action ->
+ SideActionConfirmDialog(
+ action = action,
+ isPaused = isPaused,
+ audioMuted = audioMuted,
+ onDismiss = { pendingConfirm = null },
+ onConfirm = {
+ pendingConfirm = null
+ when (action) {
+ SideConfirmAction.SHARE_LIVE -> onShareLive()
+ SideConfirmAction.SHARE_REGIA -> onShareRegia()
+ SideConfirmAction.ADVANCE_PERIOD -> onAdvancePeriod?.invoke()
+ SideConfirmAction.PAUSE_OR_RESUME -> onPauseOrResume()
+ SideConfirmAction.TOGGLE_MUTE -> onToggleAudioMute()
+ SideConfirmAction.TERMINATE -> onTerminate()
}
},
)
@@ -216,13 +212,13 @@ fun BroadcastControlsOverlay(
SideIconButton(
icon = Icons.Default.Share,
contentDescription = stringResource(R.string.broadcast_share_live_cd),
- onClick = onShareLive,
+ onClick = { pendingConfirm = SideConfirmAction.SHARE_LIVE },
enabled = shareLiveEnabled,
)
SideIconButton(
icon = Icons.Default.Videocam,
contentDescription = stringResource(R.string.broadcast_share_regia_cd),
- onClick = onShareRegia,
+ onClick = { pendingConfirm = SideConfirmAction.SHARE_REGIA },
)
SideIconButton(
icon = Icons.Default.Tune,
@@ -240,7 +236,7 @@ fun BroadcastControlsOverlay(
SideIconButton(
icon = Icons.Default.SkipNext,
contentDescription = stringResource(R.string.broadcast_next_period_cd),
- onClick = onAdvancePeriod,
+ onClick = { pendingConfirm = SideConfirmAction.ADVANCE_PERIOD },
)
}
}
@@ -258,7 +254,7 @@ fun BroadcastControlsOverlay(
} else {
stringResource(R.string.broadcast_pause_cd)
},
- onClick = onPauseOrResume,
+ onClick = { pendingConfirm = SideConfirmAction.PAUSE_OR_RESUME },
highlighted = isPaused,
)
SideIconButton(
@@ -268,13 +264,13 @@ fun BroadcastControlsOverlay(
} else {
stringResource(R.string.broadcast_mute_cd)
},
- onClick = onToggleAudioMute,
+ onClick = { pendingConfirm = SideConfirmAction.TOGGLE_MUTE },
highlighted = audioMuted,
)
SideIconButton(
icon = Icons.Default.Stop,
contentDescription = stringResource(R.string.broadcast_terminate_cd),
- onClick = { showTerminateConfirm = true },
+ onClick = { pendingConfirm = SideConfirmAction.TERMINATE },
danger = true,
)
}
@@ -770,6 +766,94 @@ private fun MinQualityOptionChip(
}
}
+@Composable
+private fun SideActionConfirmDialog(
+ action: SideConfirmAction,
+ isPaused: Boolean,
+ audioMuted: Boolean,
+ onDismiss: () -> Unit,
+ onConfirm: () -> Unit,
+) {
+ val title: String
+ val message: String
+ val confirmLabel: String
+ val confirmColor: Color
+ when (action) {
+ SideConfirmAction.SHARE_LIVE -> {
+ title = stringResource(R.string.broadcast_share_live_title)
+ message = stringResource(R.string.broadcast_share_live_message)
+ confirmLabel = stringResource(R.string.action_confirm)
+ confirmColor = Color.White
+ }
+ SideConfirmAction.SHARE_REGIA -> {
+ title = stringResource(R.string.broadcast_share_regia_title)
+ message = stringResource(R.string.broadcast_share_regia_message)
+ confirmLabel = stringResource(R.string.action_confirm)
+ confirmColor = Color.White
+ }
+ SideConfirmAction.ADVANCE_PERIOD -> {
+ title = stringResource(R.string.broadcast_advance_period_title)
+ message = stringResource(R.string.broadcast_advance_period_message)
+ confirmLabel = stringResource(R.string.action_confirm)
+ confirmColor = Color.White
+ }
+ SideConfirmAction.PAUSE_OR_RESUME -> {
+ if (isPaused) {
+ title = stringResource(R.string.broadcast_resume_title)
+ message = stringResource(R.string.broadcast_resume_message)
+ } else {
+ title = stringResource(R.string.broadcast_pause_title)
+ message = stringResource(R.string.broadcast_pause_message)
+ }
+ confirmLabel = stringResource(R.string.action_confirm)
+ confirmColor = Color.White
+ }
+ SideConfirmAction.TOGGLE_MUTE -> {
+ if (audioMuted) {
+ title = stringResource(R.string.broadcast_unmute_title)
+ message = stringResource(R.string.broadcast_unmute_message)
+ } else {
+ title = stringResource(R.string.broadcast_mute_title)
+ message = stringResource(R.string.broadcast_mute_message)
+ }
+ confirmLabel = stringResource(R.string.action_confirm)
+ confirmColor = Color.White
+ }
+ SideConfirmAction.TERMINATE -> {
+ title = stringResource(R.string.broadcast_terminate_title)
+ message = stringResource(R.string.broadcast_terminate_message)
+ confirmLabel = stringResource(R.string.broadcast_terminate_confirm)
+ confirmColor = MatchColors.PrimaryRed
+ }
+ }
+
+ AlertDialog(
+ onDismissRequest = onDismiss,
+ containerColor = MatchColors.SurfaceElevated,
+ title = { Text(title) },
+ text = { Text(message) },
+ confirmButton = {
+ TextButton(onClick = onConfirm) {
+ Text(confirmLabel, color = confirmColor)
+ }
+ },
+ dismissButton = {
+ TextButton(onClick = onDismiss) {
+ Text(stringResource(R.string.action_cancel), color = MatchColors.TextSecondary)
+ }
+ },
+ )
+}
+
+private enum class SideConfirmAction {
+ SHARE_LIVE,
+ SHARE_REGIA,
+ ADVANCE_PERIOD,
+ PAUSE_OR_RESUME,
+ TOGGLE_MUTE,
+ TERMINATE,
+}
+
@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun SideIconButton(
diff --git a/native/android/app/src/main/kotlin/com/matchlivetv/match_live_tv/ui/broadcast/LiveScoreActions.kt b/native/android/app/src/main/kotlin/com/matchlivetv/match_live_tv/ui/broadcast/LiveScoreActions.kt
index 4aa7cfe..2d707fc 100644
--- a/native/android/app/src/main/kotlin/com/matchlivetv/match_live_tv/ui/broadcast/LiveScoreActions.kt
+++ b/native/android/app/src/main/kotlin/com/matchlivetv/match_live_tv/ui/broadcast/LiveScoreActions.kt
@@ -14,6 +14,7 @@ import kotlin.coroutines.resume
enum class ScoreDialogKind {
SET_WON,
+ CLOSE_SET,
CLOSE_SET_ANYWAY,
MATCH_WON,
}
@@ -78,6 +79,9 @@ fun ScoreDialogRouter(
onDismiss = host::resolve,
)
}
+ ScoreDialogKind.CLOSE_SET -> {
+ CloseSetConfirmDialog(onDismiss = host::resolve)
+ }
ScoreDialogKind.CLOSE_SET_ANYWAY -> {
CloseSetAnywayDialog(onDismiss = host::resolve)
}
@@ -136,10 +140,16 @@ class LiveScoreActions(
awayPoints = score.awayPoints,
currentSet = score.currentSet,
)
- if (winner == null) {
- val ok = dialogHost.show(ScoreDialogState(kind = ScoreDialogKind.CLOSE_SET_ANYWAY))
- if (!ok) return
- }
+ val ok = dialogHost.show(
+ ScoreDialogState(
+ kind = if (winner == null) {
+ ScoreDialogKind.CLOSE_SET_ANYWAY
+ } else {
+ ScoreDialogKind.CLOSE_SET
+ },
+ ),
+ )
+ if (!ok) return
scoreController.closeSet()
afterCloseSet(onStopStream)
}
diff --git a/native/android/app/src/main/kotlin/com/matchlivetv/match_live_tv/ui/broadcast/ScoreOutcomeDialogs.kt b/native/android/app/src/main/kotlin/com/matchlivetv/match_live_tv/ui/broadcast/ScoreOutcomeDialogs.kt
index aa7627a..2040db1 100644
--- a/native/android/app/src/main/kotlin/com/matchlivetv/match_live_tv/ui/broadcast/ScoreOutcomeDialogs.kt
+++ b/native/android/app/src/main/kotlin/com/matchlivetv/match_live_tv/ui/broadcast/ScoreOutcomeDialogs.kt
@@ -38,6 +38,28 @@ fun SetWonDialog(
)
}
+@Composable
+fun CloseSetConfirmDialog(onDismiss: (confirmed: Boolean) -> Unit) {
+ AlertDialog(
+ onDismissRequest = { onDismiss(false) },
+ containerColor = MatchColors.Surface,
+ title = { Text(stringResource(R.string.score_action_close_set)) },
+ text = {
+ Text(stringResource(R.string.broadcast_close_set_confirm_message))
+ },
+ confirmButton = {
+ FilledTonalButton(onClick = { onDismiss(true) }) {
+ Text(stringResource(R.string.score_action_close_set), color = Color.Black)
+ }
+ },
+ dismissButton = {
+ TextButton(onClick = { onDismiss(false) }) {
+ Text(stringResource(R.string.action_cancel))
+ }
+ },
+ )
+}
+
@Composable
fun CloseSetAnywayDialog(onDismiss: (confirmed: Boolean) -> Unit) {
AlertDialog(
diff --git a/native/android/app/src/main/res/values-de/strings.xml b/native/android/app/src/main/res/values-de/strings.xml
index caf9f9b..d6f1af3 100644
--- a/native/android/app/src/main/res/values-de/strings.xml
+++ b/native/android/app/src/main/res/values-de/strings.xml
@@ -12,6 +12,7 @@
Abmelden
Anmelden
Abbrechen
+ Bestätigen
Speichern
E-Mail
Passwort
@@ -172,6 +173,21 @@
Livestream beenden?
Der Stream wird für alle Zuschauer beendet.
BEENDEN
+ Livestream pausieren?
+ Das Cover bleibt on air, bis du fortsetzt.
+ Livestream fortsetzen?
+ Die Kamera geht wieder on air statt des Covers.
+ Audio stummschalten?
+ Das Mikrofon wird nicht mehr an den Stream gesendet, bis du es wieder aktivierst.
+ Audio wieder aktivieren?
+ Das Mikrofon ist wieder aktiv im Stream.
+ Zum nächsten Abschnitt wechseln?
+ Die Anzeigetafel wechselt zum nächsten Abschnitt und der aktuelle Stand wird gespeichert.
+ Livestream teilen?
+ Es öffnet sich das Teilen-Menü mit dem öffentlichen Live-Link.
+ Regie-Link teilen?
+ Es öffnet sich das Teilen-Menü mit dem Link zur Fernsteuerung des Spielstands.
+ Bestätigst du das Beenden des aktuellen Satzes?
Steuerung ausblenden
Steuerung einblenden
Livestream teilen
diff --git a/native/android/app/src/main/res/values-en/strings.xml b/native/android/app/src/main/res/values-en/strings.xml
index fe44dfa..2037c1a 100644
--- a/native/android/app/src/main/res/values-en/strings.xml
+++ b/native/android/app/src/main/res/values-en/strings.xml
@@ -12,6 +12,7 @@
Log out
Log in
Cancel
+ Confirm
Save
Email
Password
@@ -172,6 +173,21 @@
End the live stream?
The stream will be closed for all viewers.
END
+ Pause the live stream?
+ The cover slate will stay on air until you resume.
+ Resume the live stream?
+ The camera will go back on air instead of the cover slate.
+ Mute audio?
+ The microphone will not be sent to the stream until you unmute.
+ Unmute audio?
+ The microphone will be active on the stream again.
+ Advance to the next period?
+ The scoreboard will move to the next period and the current period score will be saved.
+ Share the live stream?
+ This opens the share sheet with the public live link.
+ Share the control room link?
+ This opens the share sheet with the remote scoring link.
+ Confirm closing the current set?
Hide controls
Show controls
Share live stream
diff --git a/native/android/app/src/main/res/values-es/strings.xml b/native/android/app/src/main/res/values-es/strings.xml
index 4cc36fb..ed090e7 100644
--- a/native/android/app/src/main/res/values-es/strings.xml
+++ b/native/android/app/src/main/res/values-es/strings.xml
@@ -12,6 +12,7 @@
Salir
Acceder
Cancelar
+ Confirmar
Guardar
Email
Contraseña
@@ -172,6 +173,21 @@
¿Terminar el directo?
El streaming se cerrará para todos los espectadores.
TERMINAR
+ ¿Pausar el directo?
+ La portada seguirá en antena hasta que lo reanudes.
+ ¿Reanudar el directo?
+ La cámara volverá a antena en lugar de la portada.
+ ¿Silenciar el audio?
+ El micrófono no se enviará al stream hasta que lo reactives.
+ ¿Reactivar el audio?
+ El micrófono volverá a estar activo en el stream.
+ ¿Pasar al periodo siguiente?
+ El marcador pasará al siguiente periodo y se guardará el marcador del periodo actual.
+ ¿Compartir el directo?
+ Se abrirá el menú de compartir con el enlace público del directo.
+ ¿Compartir el enlace de regie?
+ Se abrirá el menú de compartir con el enlace para gestionar el marcador a distancia.
+ ¿Confirmas el cierre del set actual?
Ocultar controles
Mostrar controles
Compartir directo
diff --git a/native/android/app/src/main/res/values-fr/strings.xml b/native/android/app/src/main/res/values-fr/strings.xml
index c8ec168..7930cf7 100644
--- a/native/android/app/src/main/res/values-fr/strings.xml
+++ b/native/android/app/src/main/res/values-fr/strings.xml
@@ -12,6 +12,7 @@
Déconnexion
Connexion
Annuler
+ Confirmer
Enregistrer
E-mail
Mot de passe
@@ -172,6 +173,21 @@
Terminer le direct ?
Le streaming sera fermé pour tous les spectateurs.
TERMINER
+ Mettre le direct en pause ?
+ La couverture restera à l\'antenne jusqu\'à la reprise.
+ Reprendre le direct ?
+ La caméra reviendra à l\'antenne à la place de la couverture.
+ Couper l\'audio ?
+ Le micro ne sera plus envoyé au flux tant que vous ne le réactivez pas.
+ Réactiver l\'audio ?
+ Le micro sera à nouveau actif sur le flux.
+ Passer à la période suivante ?
+ Le tableau passera à la période suivante et le score de la période en cours sera enregistré.
+ Partager le direct ?
+ Cela ouvre le menu de partage avec le lien public du direct.
+ Partager le lien régie ?
+ Cela ouvre le menu de partage avec le lien de scoring distant.
+ Confirmez la clôture du set en cours ?
Masquer les commandes
Afficher les commandes
Partager le direct
diff --git a/native/android/app/src/main/res/values/strings.xml b/native/android/app/src/main/res/values/strings.xml
index b9b5ad8..7dc4f16 100644
--- a/native/android/app/src/main/res/values/strings.xml
+++ b/native/android/app/src/main/res/values/strings.xml
@@ -13,6 +13,7 @@
Esci
Accedi
Annulla
+ Conferma
Salva
Email
Password
@@ -173,6 +174,21 @@
Terminare la diretta?
Lo streaming verrà chiuso per tutti gli spettatori.
TERMINA
+ Mettere in pausa?
+ La diretta passerà alla copertina finché non la riprendi.
+ Riprendere la diretta?
+ La telecamera tornerà in onda al posto della copertina.
+ Silenziare l\'audio?
+ Il microfono non verrà inviato allo stream finché non lo riattivi.
+ Riattivare l\'audio?
+ Il microfono tornerà attivo sullo stream.
+ Passare al periodo successivo?
+ Il tabellone passerà al periodo successivo e il punteggio del periodo corrente sarà salvato.
+ Condividere la diretta?
+ Aprirai il menu di condivisione con il link pubblico della diretta.
+ Condividere il link regia?
+ Aprirai il menu di condivisione con il link per gestire il punteggio da remoto.
+ Confermi la chiusura del set corrente?
Nascondi controlli
Mostra controlli
Condividi diretta
diff --git a/native/ios/MatchLiveTv/Core/AppLanguage.swift b/native/ios/MatchLiveTv/Core/AppLanguage.swift
index 9100ac7..3c171f0 100644
--- a/native/ios/MatchLiveTv/Core/AppLanguage.swift
+++ b/native/ios/MatchLiveTv/Core/AppLanguage.swift
@@ -74,6 +74,7 @@ enum L10n {
private static let table: [String: [String: String]] = [
"it": [
"action.cancel": "Annulla",
+ "action.confirm": "Conferma",
"action.delete": "Elimina",
"action.exit": "Esci",
"action.login": "Accedi",
@@ -174,6 +175,21 @@ enum L10n {
"broadcast.terminate.confirm": "TERMINA",
"broadcast.terminate.message": "Lo streaming verrà chiuso per tutti gli spettatori.",
"broadcast.terminate.title": "Terminare la diretta?",
+ "broadcast.pause.title": "Mettere in pausa?",
+ "broadcast.pause.message": "La diretta passerà alla copertina finché non la riprendi.",
+ "broadcast.resume.title": "Riprendere la diretta?",
+ "broadcast.resume.message": "La telecamera tornerà in onda al posto della copertina.",
+ "broadcast.mute.title": "Silenziare l'audio?",
+ "broadcast.mute.message": "Il microfono non verrà inviato allo stream finché non lo riattivi.",
+ "broadcast.unmute.title": "Riattivare l'audio?",
+ "broadcast.unmute.message": "Il microfono tornerà attivo sullo stream.",
+ "broadcast.advance.period.title": "Passare al periodo successivo?",
+ "broadcast.advance.period.message": "Il tabellone passerà al periodo successivo e il punteggio del periodo corrente sarà salvato.",
+ "broadcast.share.live.title": "Condividere la diretta?",
+ "broadcast.share.live.message": "Aprirai il menu di condivisione con il link pubblico della diretta.",
+ "broadcast.share.regia.title": "Condividere il link regia?",
+ "broadcast.share.regia.message": "Aprirai il menu di condivisione con il link per gestire il punteggio da remoto.",
+ "broadcast.close.set.confirm.message": "Confermi la chiusura del set corrente?",
"broadcast.tooltip.add.point": "Aggiungi punto %1$@",
"broadcast.tooltip.plus.side": "+%1$d %2$@",
"broadcast.tooltip.remove.point": "Togli punto %1$@",
@@ -389,6 +405,7 @@ enum L10n {
],
"en": [
"action.cancel": "Cancel",
+ "action.confirm": "Confirm",
"action.delete": "Delete",
"action.exit": "Exit",
"action.login": "Log in",
@@ -489,6 +506,21 @@ enum L10n {
"broadcast.terminate.confirm": "END",
"broadcast.terminate.message": "The stream will be closed for all viewers.",
"broadcast.terminate.title": "End the live stream?",
+ "broadcast.pause.title": "Pause the live stream?",
+ "broadcast.pause.message": "The cover slate will stay on air until you resume.",
+ "broadcast.resume.title": "Resume the live stream?",
+ "broadcast.resume.message": "The camera will go back on air instead of the cover slate.",
+ "broadcast.mute.title": "Mute audio?",
+ "broadcast.mute.message": "The microphone will not be sent to the stream until you unmute.",
+ "broadcast.unmute.title": "Unmute audio?",
+ "broadcast.unmute.message": "The microphone will be active on the stream again.",
+ "broadcast.advance.period.title": "Advance to the next period?",
+ "broadcast.advance.period.message": "The scoreboard will move to the next period and the current period score will be saved.",
+ "broadcast.share.live.title": "Share the live stream?",
+ "broadcast.share.live.message": "This opens the share sheet with the public live link.",
+ "broadcast.share.regia.title": "Share the control room link?",
+ "broadcast.share.regia.message": "This opens the share sheet with the remote scoring link.",
+ "broadcast.close.set.confirm.message": "Confirm closing the current set?",
"broadcast.tooltip.add.point": "Add point %1$@",
"broadcast.tooltip.plus.side": "+%1$d %2$@",
"broadcast.tooltip.remove.point": "Remove point %1$@",
@@ -704,6 +736,7 @@ enum L10n {
],
"fr": [
"action.cancel": "Annuler",
+ "action.confirm": "Confirmer",
"action.delete": "Supprimer",
"action.exit": "Quitter",
"action.login": "Connexion",
@@ -804,6 +837,21 @@ enum L10n {
"broadcast.terminate.confirm": "TERMINER",
"broadcast.terminate.message": "Le streaming sera fermé pour tous les spectateurs.",
"broadcast.terminate.title": "Terminer le direct ?",
+ "broadcast.pause.title": "Mettre le direct en pause ?",
+ "broadcast.pause.message": "La couverture restera à l'antenne jusqu'à la reprise.",
+ "broadcast.resume.title": "Reprendre le direct ?",
+ "broadcast.resume.message": "La caméra reviendra à l'antenne à la place de la couverture.",
+ "broadcast.mute.title": "Couper l'audio ?",
+ "broadcast.mute.message": "Le micro ne sera plus envoyé au flux tant que vous ne le réactivez pas.",
+ "broadcast.unmute.title": "Réactiver l'audio ?",
+ "broadcast.unmute.message": "Le micro sera à nouveau actif sur le flux.",
+ "broadcast.advance.period.title": "Passer à la période suivante ?",
+ "broadcast.advance.period.message": "Le tableau passera à la période suivante et le score de la période en cours sera enregistré.",
+ "broadcast.share.live.title": "Partager le direct ?",
+ "broadcast.share.live.message": "Cela ouvre le menu de partage avec le lien public du direct.",
+ "broadcast.share.regia.title": "Partager le lien régie ?",
+ "broadcast.share.regia.message": "Cela ouvre le menu de partage avec le lien de scoring distant.",
+ "broadcast.close.set.confirm.message": "Confirmez la clôture du set en cours ?",
"broadcast.tooltip.add.point": "Ajouter un point %1$@",
"broadcast.tooltip.plus.side": "+%1$d %2$@",
"broadcast.tooltip.remove.point": "Retirer un point %1$@",
@@ -1019,6 +1067,7 @@ enum L10n {
],
"de": [
"action.cancel": "Abbrechen",
+ "action.confirm": "Bestätigen",
"action.delete": "Löschen",
"action.exit": "Beenden",
"action.login": "Anmelden",
@@ -1119,6 +1168,21 @@ enum L10n {
"broadcast.terminate.confirm": "BEENDEN",
"broadcast.terminate.message": "Der Stream wird für alle Zuschauer beendet.",
"broadcast.terminate.title": "Livestream beenden?",
+ "broadcast.pause.title": "Livestream pausieren?",
+ "broadcast.pause.message": "Das Cover bleibt on air, bis du fortsetzt.",
+ "broadcast.resume.title": "Livestream fortsetzen?",
+ "broadcast.resume.message": "Die Kamera geht wieder on air statt des Covers.",
+ "broadcast.mute.title": "Audio stummschalten?",
+ "broadcast.mute.message": "Das Mikrofon wird nicht mehr an den Stream gesendet, bis du es wieder aktivierst.",
+ "broadcast.unmute.title": "Audio wieder aktivieren?",
+ "broadcast.unmute.message": "Das Mikrofon ist wieder aktiv im Stream.",
+ "broadcast.advance.period.title": "Zum nächsten Abschnitt wechseln?",
+ "broadcast.advance.period.message": "Die Anzeigetafel wechselt zum nächsten Abschnitt und der aktuelle Stand wird gespeichert.",
+ "broadcast.share.live.title": "Livestream teilen?",
+ "broadcast.share.live.message": "Es öffnet sich das Teilen-Menü mit dem öffentlichen Live-Link.",
+ "broadcast.share.regia.title": "Regie-Link teilen?",
+ "broadcast.share.regia.message": "Es öffnet sich das Teilen-Menü mit dem Link zur Fernsteuerung des Spielstands.",
+ "broadcast.close.set.confirm.message": "Bestätigst du das Beenden des aktuellen Satzes?",
"broadcast.tooltip.add.point": "Punkt hinzufügen %1$@",
"broadcast.tooltip.plus.side": "+%1$d %2$@",
"broadcast.tooltip.remove.point": "Punkt entfernen %1$@",
@@ -1334,6 +1398,7 @@ enum L10n {
],
"es": [
"action.cancel": "Cancelar",
+ "action.confirm": "Confirmar",
"action.delete": "Eliminar",
"action.exit": "Salir",
"action.login": "Acceder",
@@ -1434,6 +1499,21 @@ enum L10n {
"broadcast.terminate.confirm": "TERMINAR",
"broadcast.terminate.message": "El streaming se cerrará para todos los espectadores.",
"broadcast.terminate.title": "¿Terminar el directo?",
+ "broadcast.pause.title": "¿Pausar el directo?",
+ "broadcast.pause.message": "La portada seguirá en antena hasta que lo reanudes.",
+ "broadcast.resume.title": "¿Reanudar el directo?",
+ "broadcast.resume.message": "La cámara volverá a antena en lugar de la portada.",
+ "broadcast.mute.title": "¿Silenciar el audio?",
+ "broadcast.mute.message": "El micrófono no se enviará al stream hasta que lo reactives.",
+ "broadcast.unmute.title": "¿Reactivar el audio?",
+ "broadcast.unmute.message": "El micrófono volverá a estar activo en el stream.",
+ "broadcast.advance.period.title": "¿Pasar al periodo siguiente?",
+ "broadcast.advance.period.message": "El marcador pasará al siguiente periodo y se guardará el marcador del periodo actual.",
+ "broadcast.share.live.title": "¿Compartir el directo?",
+ "broadcast.share.live.message": "Se abrirá el menú de compartir con el enlace público del directo.",
+ "broadcast.share.regia.title": "¿Compartir el enlace de regie?",
+ "broadcast.share.regia.message": "Se abrirá el menú de compartir con el enlace para gestionar el marcador a distancia.",
+ "broadcast.close.set.confirm.message": "¿Confirmas el cierre del set actual?",
"broadcast.tooltip.add.point": "Añadir punto %1$@",
"broadcast.tooltip.plus.side": "+%1$d %2$@",
"broadcast.tooltip.remove.point": "Quitar punto %1$@",
diff --git a/native/ios/MatchLiveTv/UI/Broadcast/BroadcastControlsOverlay.swift b/native/ios/MatchLiveTv/UI/Broadcast/BroadcastControlsOverlay.swift
index 4644681..43e7bdc 100644
--- a/native/ios/MatchLiveTv/UI/Broadcast/BroadcastControlsOverlay.swift
+++ b/native/ios/MatchLiveTv/UI/Broadcast/BroadcastControlsOverlay.swift
@@ -4,6 +4,15 @@ private let sideToolbarWidth: CGFloat = 44
private let iconButtonSize: CGFloat = 36
private let scoreButtonHeight: CGFloat = 32
+private enum SideConfirmAction {
+ case shareLive
+ case shareRegia
+ case advancePeriod
+ case pauseOrResume
+ case toggleMute
+ case terminate
+}
+
struct BroadcastControlsOverlay: View {
let controlsVisible: Bool
let onToggleControls: () -> Void
@@ -46,7 +55,7 @@ struct BroadcastControlsOverlay: View {
var sessionQualityPreset: String = "720p_30_2.5mbps"
var onSelectMinQuality: (String) -> Void = { _ in }
- @State private var showTerminateConfirm = false
+ @State private var pendingConfirm: SideConfirmAction?
@State private var showMinQualityPicker = false
var body: some View {
@@ -118,11 +127,62 @@ struct BroadcastControlsOverlay: View {
)
}
}
- .alert(L10n.t("broadcast.terminate.title"), isPresented: $showTerminateConfirm) {
- Button(L10n.t("action.cancel"), role: .cancel) {}
- Button(L10n.t("broadcast.terminate.confirm"), role: .destructive, action: onTerminate)
- } message: {
- Text(L10n.t("broadcast.terminate.message"))
+ .alert(
+ sideConfirmTitle,
+ isPresented: Binding(
+ get: { pendingConfirm != nil },
+ set: { if !$0 { pendingConfirm = nil } }
+ )
+ ) {
+ Button(L10n.t("action.cancel"), role: .cancel) { pendingConfirm = nil }
+ if pendingConfirm == .terminate {
+ Button(L10n.t("broadcast.terminate.confirm"), role: .destructive, action: performPendingConfirm)
+ } else {
+ Button(L10n.t("action.confirm"), action: performPendingConfirm)
+ }
+ } message: {
+ Text(sideConfirmMessage)
+ }
+ }
+
+ private var sideConfirmTitle: String {
+ switch pendingConfirm {
+ case .shareLive: return L10n.t("broadcast.share.live.title")
+ case .shareRegia: return L10n.t("broadcast.share.regia.title")
+ case .advancePeriod: return L10n.t("broadcast.advance.period.title")
+ case .pauseOrResume:
+ return isPaused ? L10n.t("broadcast.resume.title") : L10n.t("broadcast.pause.title")
+ case .toggleMute:
+ return audioMuted ? L10n.t("broadcast.unmute.title") : L10n.t("broadcast.mute.title")
+ case .terminate: return L10n.t("broadcast.terminate.title")
+ case .none: return ""
+ }
+ }
+
+ private var sideConfirmMessage: String {
+ switch pendingConfirm {
+ case .shareLive: return L10n.t("broadcast.share.live.message")
+ case .shareRegia: return L10n.t("broadcast.share.regia.message")
+ case .advancePeriod: return L10n.t("broadcast.advance.period.message")
+ case .pauseOrResume:
+ return isPaused ? L10n.t("broadcast.resume.message") : L10n.t("broadcast.pause.message")
+ case .toggleMute:
+ return audioMuted ? L10n.t("broadcast.unmute.message") : L10n.t("broadcast.mute.message")
+ case .terminate: return L10n.t("broadcast.terminate.message")
+ case .none: return ""
+ }
+ }
+
+ private func performPendingConfirm() {
+ guard let action = pendingConfirm else { return }
+ pendingConfirm = nil
+ switch action {
+ case .shareLive: onShareLive()
+ case .shareRegia: onShareRegia()
+ case .advancePeriod: onAdvancePeriod?()
+ case .pauseOrResume: onPauseOrResume()
+ case .toggleMute: onToggleAudioMute()
+ case .terminate: onTerminate()
}
}
@@ -131,13 +191,13 @@ struct BroadcastControlsOverlay: View {
SideIconButton(
systemName: "square.and.arrow.up",
accessibilityLabel: L10n.t("broadcast.share.live.cd"),
- action: onShareLive,
+ action: { pendingConfirm = .shareLive },
enabled: shareLiveEnabled
)
SideIconButton(
systemName: "video.fill",
accessibilityLabel: L10n.t("broadcast.share.regia.cd"),
- action: onShareRegia
+ action: { pendingConfirm = .shareRegia }
)
SideIconButton(
systemName: "slider.horizontal.3",
@@ -151,11 +211,11 @@ struct BroadcastControlsOverlay: View {
action: onCloseSet
)
}
- if let onAdvancePeriod {
+ if onAdvancePeriod != nil {
SideIconButton(
systemName: "forward.end.fill",
accessibilityLabel: L10n.t("broadcast.next.period.cd"),
- action: onAdvancePeriod
+ action: { pendingConfirm = .advancePeriod }
)
}
}
@@ -168,19 +228,19 @@ struct BroadcastControlsOverlay: View {
SideIconButton(
systemName: isPaused ? "play.fill" : "pause.fill",
accessibilityLabel: isPaused ? L10n.t("broadcast.resume.cd") : L10n.t("broadcast.pause.cd"),
- action: onPauseOrResume,
+ action: { pendingConfirm = .pauseOrResume },
highlighted: isPaused
)
SideIconButton(
systemName: audioMuted ? "speaker.slash.fill" : "speaker.wave.2.fill",
accessibilityLabel: audioMuted ? L10n.t("broadcast.unmute.cd") : L10n.t("broadcast.mute.cd"),
- action: onToggleAudioMute,
+ action: { pendingConfirm = .toggleMute },
highlighted: audioMuted
)
SideIconButton(
systemName: "stop.fill",
accessibilityLabel: L10n.t("broadcast.terminate.cd"),
- action: { showTerminateConfirm = true },
+ action: { pendingConfirm = .terminate },
danger: true
)
}
diff --git a/native/ios/MatchLiveTv/UI/Broadcast/LiveScoreActions.swift b/native/ios/MatchLiveTv/UI/Broadcast/LiveScoreActions.swift
index f5b1923..9dd6b73 100644
--- a/native/ios/MatchLiveTv/UI/Broadcast/LiveScoreActions.swift
+++ b/native/ios/MatchLiveTv/UI/Broadcast/LiveScoreActions.swift
@@ -3,6 +3,7 @@ import SwiftUI
enum ScoreDialogKind {
case setWon
+ case closeSet
case closeSetAnyway
case matchWon
}
@@ -92,10 +93,10 @@ final class LiveScoreActions {
awayPoints: score.awayPoints,
currentSet: score.currentSet
)
- if winner == nil {
- let ok = await dialogHost.show(ScoreDialogState(kind: .closeSetAnyway))
- if !ok { return }
- }
+ let ok = await dialogHost.show(
+ ScoreDialogState(kind: winner == nil ? .closeSetAnyway : .closeSet)
+ )
+ if !ok { return }
guard await scoreController.closeSetAsync() else { return }
onScoreboardChanged()
await afterCloseSet()
@@ -149,6 +150,13 @@ struct ScoreDialogRouter: View {
primaryButton: .default(Text(L10n.t("score.action.close.set"))) { host.resolve(true) },
secondaryButton: .cancel(Text(L10n.t("score.action.continue.scoring"))) { host.resolve(false) }
)
+ case .closeSet:
+ return Alert(
+ title: Text(L10n.t("score.action.close.set")),
+ message: Text(L10n.t("broadcast.close.set.confirm.message")),
+ primaryButton: .default(Text(L10n.t("score.action.close.set"))) { host.resolve(true) },
+ secondaryButton: .cancel(Text(L10n.t("action.cancel"))) { host.resolve(false) }
+ )
case .closeSetAnyway:
return Alert(
title: Text(L10n.t("score.action.close.set")),