Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Stop a new episode shoving the podcast you are listening to out of the top spot

Barnabas029e4243ced2
diff --git a/lib/providers/_lp_core.dart b/lib/providers/_lp_core.dart
index bf023771..64059c95 100644
--- a/lib/providers/_lp_core.dart
+++ b/lib/providers/_lp_core.dart
@@ -2453,8 +2453,24 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
}
break;
default:
- _absorbingIdsAdd(key, atFront: true);
- startFrontKey = key;
+ // The slot under the needle stays put: when the front card is
+ // the item that is loaded in the player, a new episode lands
+ // right behind it instead of on top - otherwise the card you
+ // are listening to "drops" to #2 the moment you pause.
+ final p = AudioPlayerService();
+ final activeKey = p.currentEpisodeId != null
+ ? '${p.currentItemId}-${p.currentEpisodeId}'
+ : p.currentItemId;
+ final frontIsActive = p.hasBook &&
+ activeKey != null &&
+ _absorbingBookIds.isNotEmpty &&
+ _absorbingBookIds.first == activeKey;
+ if (frontIsActive) {
+ _absorbingIdsAdd(key, atIndex: 1);
+ } else {
+ _absorbingIdsAdd(key, atFront: true);
+ startFrontKey = key;
+ }
}
// Only cache what the queue will render. A queue-less show would
// otherwise grow this cache with entries nothing ever reads.