A cross platform Audiobookshelf client for Android and iOS
Dart
Fix book not auto-playing when switching from absorbing cards
Nathan Poulson0e6fcb29abfa
diff --git a/lib/services/audio_player_service.dart b/lib/services/audio_player_service.dartindex fad1af13..6ae76611 100644--- a/lib/services/audio_player_service.dart+++ b/lib/services/audio_player_service.dart@@ -1069,6 +1069,19 @@ class AudioPlayerService extends ChangeNotifier {}notifyListeners();+ // Cancel old sync/completion listeners before switching sources.+ // Without this, stale position or processingState events from the+ // previous book can fire during setAudioSource() and trigger+ // _onPlaybackComplete(), killing the new playback before it starts.+ _syncSub?.cancel();+ _syncSub = null;+ _completionSub?.cancel();+ _completionSub = null;+ _indexSub?.cancel();+ _indexSub = null;+ _lastKnownPositionSec = 0;+ _isCompletingBook = false;+// Check if downloaded — play locallyfinal bool result;if (_downloadService.isDownloaded(progressKey)) {