fix: only set playingMessageId on first auto-played chunk to prevent race
| .. | .. |
|---|
| 519 | 519 | _scrollToBottom(); |
|---|
| 520 | 520 | |
|---|
| 521 | 521 | 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 | + } |
|---|
| 523 | 528 | AudioService.queueBase64(audioData); |
|---|
| 524 | 529 | } |
|---|
| 525 | 530 | } |
|---|