Implementa pausa diretta con copertina slate e ripresa.

Metti in pausa ferma RTMP lato app mantenendo la camera aperta, MediaMTX
manda offline.mp4 agli spettatori e Chiudi termina definitivamente.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-02 23:31:48 +02:00
parent 1bd81d84af
commit a87cda156b
19 changed files with 305 additions and 45 deletions

View File

@@ -12,7 +12,7 @@ Future<bool> confirmEndStream(BuildContext context) async {
content: const Text(
'La diretta verrà chiusa definitivamente. '
'Gli spettatori vedranno che lo stream è terminato e non potrai riprendere questa sessione.\n\n'
'Per una pausa temporanea usa «Interrompi».',
'Per una pausa temporanea usa «Metti in pausa».',
),
actions: [
TextButton(

View File

@@ -8,10 +8,12 @@ class LiveBadge extends StatelessWidget {
super.key,
required this.elapsed,
this.compact = false,
this.paused = false,
});
final Duration elapsed;
final bool compact;
final bool paused;
String _format(Duration d) {
final h = d.inHours;
@@ -24,29 +26,34 @@ class LiveBadge extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final bg = paused ? const Color(0xFF555555) : AppTheme.primaryRed;
final label = paused
? (compact ? 'PAUSA ${_format(elapsed)}' : 'IN PAUSA ${_format(elapsed)}')
: (compact ? 'LIVE ${_format(elapsed)}' : 'IN DIRETTA ${_format(elapsed)}');
return Container(
padding: EdgeInsets.symmetric(
horizontal: compact ? 10 : 14,
vertical: compact ? 4 : 6,
),
decoration: BoxDecoration(
color: AppTheme.primaryRed,
color: bg,
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: compact ? 6 : 8,
height: compact ? 6 : 8,
decoration: const BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
if (!paused)
Container(
width: compact ? 6 : 8,
height: compact ? 6 : 8,
decoration: const BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
),
),
),
SizedBox(width: compact ? 6 : 8),
if (!paused) SizedBox(width: compact ? 6 : 8),
Text(
compact ? 'LIVE ${_format(elapsed)}' : 'IN DIRETTA ${_format(elapsed)}',
label,
style: theme.textTheme.labelLarge?.copyWith(
color: Colors.white,
fontSize: compact ? 11 : 13,