From 74cc279069649e2722e4f1415882e2de6224841d Mon Sep 17 00:00:00 2001 From: Daniel Ponte Date: Sun, 18 Aug 2024 08:41:29 -0400 Subject: [PATCH] queue kind of works --- lib/views/radio.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/views/radio.dart b/lib/views/radio.dart index 3b74b99..86577bb 100644 --- a/lib/views/radio.dart +++ b/lib/views/radio.dart @@ -26,6 +26,7 @@ class _MainRadioState extends State { Color _ledColor = Colors.black; Timer? _lcdTimer; SBCall? _call; + Completer _completer = Completer(); @override void initState() { @@ -34,6 +35,7 @@ class _MainRadioState extends State { player.player.playerStateStream.listen((event) async { if (!event.playing && event.processingState == ProcessingState.completed) { + _completer.complete(); setState(() { _ledColor = Colors.black; }); @@ -50,9 +52,11 @@ class _MainRadioState extends State { _call = call; sb.queueLen--; }); - print("bef"); + print("bef" + DateTime.now().toString()); + _completer = Completer(); await player.play(call.call); - print("aft"); + await _completer.future; + print("aft" + DateTime.now().toString()); lcdOff(); } //); }