A cross platform Audiobookshelf client for Android and iOS
Dart
Show local cover on iOS lock screen for downloaded books
Barnabas387edf9733bb
diff --git a/lib/services/audio_player_service.dart b/lib/services/audio_player_service.dartindex 1bec1e5c..ffb8c6a9 100644--- a/lib/services/audio_player_service.dart+++ b/lib/services/audio_player_service.dart@@ -2435,10 +2435,20 @@ class AudioPlayerService extends ChangeNotifier {// Android: Always use content:// URI for Now Playing artwork - some OEMs// (e.g. Vivo) don't load HTTP URLs in MediaSession. The CoverContentProvider// handles both downloaded and streamed covers.- // iOS: Use the HTTP URL directly — content:// is Android-only.- final effectiveCoverUrl = Platform.isIOS- ? coverUrl- : 'content://$_coverAuthority/cover/$itemId';+ // iOS: prefer the local cover file for downloaded books so the lock+ // screen shows artwork even when the user is offline. Fall back to the+ // remote HTTP URL when there's no local cover (streaming).+ String? effectiveCoverUrl;+ if (Platform.isIOS) {+ final localCover = DownloadService().getInfo(itemId).localCoverPath;+ if (localCover != null && localCover.isNotEmpty) {+ effectiveCoverUrl = Uri.file(localCover).toString();+ } else {+ effectiveCoverUrl = coverUrl;+ }+ } else {+ effectiveCoverUrl = 'content://$_coverAuthority/cover/$itemId';+ }_updateNotificationMediaItem(itemId, title, author, effectiveCoverUrl, totalDuration, chapter: chapter);}diff --git a/pubspec.yaml b/pubspec.yamlindex 4cd368ce..21f5fc53 100644--- a/pubspec.yaml+++ b/pubspec.yaml@@ -1,7 +1,7 @@name: absorbdescription: An Audiobookshelf Clientpublish_to: 'none'-version: 1.8.78+111+version: 1.8.78+112environment:sdk: '>=3.1.0 <4.0.0'