Matthias Nott
2026-03-24 a8aa30beefb15b604a37867c45dc815b9da5b53a
fix: only set playingMessageId on first auto-played chunk to prevent race
1 files modified
changed files
lib/screens/chat_screen.dart patch | view | blame | history
lib/screens/chat_screen.dart
....@@ -519,7 +519,12 @@
519519 _scrollToBottom();
520520
521521 if (audioData != null && !AudioService.isBackgrounded && !_isCatchingUp && !_isRecording) {
522
- setState(() => _playingMessageId = storedMessage.id);
522
+ // Only set playing ID if nothing is currently playing (first chunk).
523
+ // Subsequent chunks just queue audio without touching the play indicator,
524
+ // preventing the completion callback race from clearing it prematurely.
525
+ if (_playingMessageId == null) {
526
+ setState(() => _playingMessageId = storedMessage.id);
527
+ }
523528 AudioService.queueBase64(audioData);
524529 }
525530 }