A cross platform Audiobookshelf client for Android and iOS
Dart
Fix Atmos absorbing card vanishing, faster cold starts, keep Atmos transcoded
Nathan Poulson29bab1a09c6a
diff --git a/lib/services/api_service.dart b/lib/services/api_service.dartindex 6d77e092..e0b18fac 100644--- a/lib/services/api_service.dart+++ b/lib/services/api_service.dart@@ -575,7 +575,9 @@ class ApiService {},'forceDirectPlay': !forceTranscode,'forceTranscode': forceTranscode,- 'mediaPlayer': 'unknown',+ // Match what the native ABS Android app sends so the server treats us+ // as a known ExoPlayer client and picks direct-play correctly.+ 'mediaPlayer': 'exo-player','supportedMimeTypes': ['audio/flac','audio/mpeg',@@ -816,7 +818,7 @@ class ApiService {},'forceDirectPlay': !forceTranscode,'forceTranscode': forceTranscode,- 'mediaPlayer': 'unknown',+ 'mediaPlayer': 'exo-player','supportedMimeTypes': ['audio/flac','audio/mpeg',diff --git a/lib/services/audio_player_service.dart b/lib/services/audio_player_service.dartindex b6f87baf..ae161a0c 100644--- a/lib/services/audio_player_service.dart+++ b/lib/services/audio_player_service.dart@@ -1860,7 +1860,23 @@ class AudioPlayerService extends ChangeNotifier {errStr.contains('Decoder') ||errStr.contains('format_supported'))) {debugPrint('[Player] Codec error detected - retrying with server transcoding');+ // Preserve item identity before wiping state so the absorbing card+ // stays visible during the retry and the episode endpoint can be used+ // correctly. _clearState() would null _currentItemId/_currentEpisodeId,+ // making hasBook = false (card vanishes) and breaking podcast retries.+ final retryItemId = _currentItemId;+ final retryEpId = _currentEpisodeId;+ final retryEpTitle = _currentEpisodeTitle;+ final retryTitle = _currentTitle;+ final retryAuthor = _currentAuthor;+ final retryCover = _currentCoverUrl;_clearState();+ _currentItemId = retryItemId;+ _currentEpisodeId = retryEpId;+ _currentEpisodeTitle = retryEpTitle;+ _currentTitle = retryTitle;+ _currentAuthor = retryAuthor;+ _currentCoverUrl = retryCover;// Close the failed sessionif (_playbackSessionId != null) {try { await api.closePlaybackSession(_playbackSessionId!); } catch (_) {}@@ -1916,6 +1932,14 @@ class AudioPlayerService extends ChangeNotifier {final sleepTimer = SleepTimerService();sleepTimer.resetDismiss();sleepTimer.checkAutoSleep();+ // Cache the transcoded session so next cold start is instant+ SessionCache.save(+ itemId: itemId,+ episodeId: _currentEpisodeId,+ audioTracks: retryTracks,+ chapters: _chapters,+ totalDuration: totalDuration,+ );return null;} catch (retryError) {debugPrint('[Player] Transcoded playback also failed: $retryError');