Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Add Android Auto speed button, chapter queue, and library switching

Nathan Poulson88ca64b32310
diff --git a/android/app/src/main/res/drawable/ic_speed.xml b/android/app/src/main/res/drawable/ic_speed.xml
new file mode 100644
index 00000000..6e2e7f18
--- /dev/null
+++ b/android/app/src/main/res/drawable/ic_speed.xml
@@ -0,0 +1,13 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="?attr/colorControlNormal">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M20.38,8.57l-1.23,1.85a8,8 0,0 1,-0.22 7.58L5.07,18A8,8 0,0 1,15.58 6.85l1.85,-1.23A10,10 0,0 0,3.35 19a2,2 0,0 0,1.72 1h13.85a2,2 0,0 0,1.74 -1 10,10 0,0 0,-0.27 -10.44z"/>
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M10.59,15.41a2,2 0,0 0,2.83 0l5.66,-8.49 -8.49,5.66a2,2 0,0 0,0 2.83z"/>
+</vector>
diff --git a/android/app/src/main/res/drawable/ic_speed_075.xml b/android/app/src/main/res/drawable/ic_speed_075.xml
new file mode 100644
index 00000000..c6379c46
--- /dev/null
+++ b/android/app/src/main/res/drawable/ic_speed_075.xml
@@ -0,0 +1,17 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="?attr/colorControlNormal">
+ <!-- "0.75x" in 7-segment style (compact) — scaled 1.4x -->
+ <group
+ android:scaleX="1.4"
+ android:scaleY="1.4"
+ android:pivotX="12"
+ android:pivotY="12">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M5.8,8.75 h2.2 v0.75 h-2.2 Z M7.65,9.15 h0.75 v2.65 h-0.75 Z M7.65,12.2 h0.75 v2.65 h-0.75 Z M5.8,14.5 h2.2 v0.75 h-2.2 Z M5.4,12.2 h0.75 v2.65 h-0.75 Z M5.4,9.15 h0.75 v2.65 h-0.75 Z M8.7,14.5 h0.75 v0.75 h-0.75 Z M10.0,8.75 h2.2 v0.75 h-2.2 Z M11.85,9.15 h0.75 v2.65 h-0.75 Z M11.85,12.2 h0.75 v2.65 h-0.75 Z M13.3,8.75 h2.2 v0.75 h-2.2 Z M15.15,12.2 h0.75 v2.65 h-0.75 Z M13.3,14.5 h2.2 v0.75 h-2.2 Z M12.9,9.15 h0.75 v2.65 h-0.75 Z M13.3,11.625 h2.2 v0.75 h-2.2 Z M16.5,10.3 L16.8,10.0 L18.9,13.7 L18.6,14.0 Z M18.6,10.0 L18.9,10.3 L16.8,14.0 L16.5,13.7 Z"/>
+ </group>
+</vector>
diff --git a/android/app/src/main/res/drawable/ic_speed_100.xml b/android/app/src/main/res/drawable/ic_speed_100.xml
new file mode 100644
index 00000000..2824111d
--- /dev/null
+++ b/android/app/src/main/res/drawable/ic_speed_100.xml
@@ -0,0 +1,17 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="?attr/colorControlNormal">
+ <!-- "1.0x" in 7-segment style — scaled 1.4x -->
+ <group
+ android:scaleX="1.4"
+ android:scaleY="1.4"
+ android:pivotX="12"
+ android:pivotY="12">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M8.03,8.95 h0.75 v6.1 h-0.75 Z M10.3,14.5 h0.75 v0.75 h-0.75 Z M11.7,8.75 h2.2 v0.75 h-2.2 Z M13.55,9.15 h0.75 v2.65 h-0.75 Z M13.55,12.2 h0.75 v2.65 h-0.75 Z M11.7,14.5 h2.2 v0.75 h-2.2 Z M11.3,12.2 h0.75 v2.65 h-0.75 Z M11.3,9.15 h0.75 v2.65 h-0.75 Z M14.7,10.3 L15.0,10.0 L17.1,13.7 L16.8,14.0 Z M16.8,10.0 L17.1,10.3 L15.0,14.0 L14.7,13.7 Z"/>
+ </group>
+</vector>
diff --git a/android/app/src/main/res/drawable/ic_speed_125.xml b/android/app/src/main/res/drawable/ic_speed_125.xml
new file mode 100644
index 00000000..21e62c8d
--- /dev/null
+++ b/android/app/src/main/res/drawable/ic_speed_125.xml
@@ -0,0 +1,17 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="?attr/colorControlNormal">
+ <!-- "1.25x" in 7-segment style (compact) — scaled 1.4x -->
+ <group
+ android:scaleX="1.4"
+ android:scaleY="1.4"
+ android:pivotX="12"
+ android:pivotY="12">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M6.53,8.95 h0.75 v6.1 h-0.75 Z M8.7,14.5 h0.75 v0.75 h-0.75 Z M10.0,8.75 h2.2 v0.75 h-2.2 Z M11.85,9.15 h0.75 v2.65 h-0.75 Z M10.0,14.5 h2.2 v0.75 h-2.2 Z M9.6,12.2 h0.75 v2.65 h-0.75 Z M10.0,11.625 h2.2 v0.75 h-2.2 Z M13.3,8.75 h2.2 v0.75 h-2.2 Z M15.15,12.2 h0.75 v2.65 h-0.75 Z M13.3,14.5 h2.2 v0.75 h-2.2 Z M12.9,9.15 h0.75 v2.65 h-0.75 Z M13.3,11.625 h2.2 v0.75 h-2.2 Z M16.5,10.3 L16.8,10.0 L18.9,13.7 L18.6,14.0 Z M18.6,10.0 L18.9,10.3 L16.8,14.0 L16.5,13.7 Z"/>
+ </group>
+</vector>
diff --git a/android/app/src/main/res/drawable/ic_speed_150.xml b/android/app/src/main/res/drawable/ic_speed_150.xml
new file mode 100644
index 00000000..c91e927e
--- /dev/null
+++ b/android/app/src/main/res/drawable/ic_speed_150.xml
@@ -0,0 +1,17 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="?attr/colorControlNormal">
+ <!-- "1.5x" in 7-segment style — scaled 1.4x -->
+ <group
+ android:scaleX="1.4"
+ android:scaleY="1.4"
+ android:pivotX="12"
+ android:pivotY="12">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M8.03,8.95 h0.75 v6.1 h-0.75 Z M10.3,14.5 h0.75 v0.75 h-0.75 Z M11.7,8.75 h2.2 v0.75 h-2.2 Z M13.55,12.2 h0.75 v2.65 h-0.75 Z M11.7,14.5 h2.2 v0.75 h-2.2 Z M11.3,9.15 h0.75 v2.65 h-0.75 Z M11.7,11.625 h2.2 v0.75 h-2.2 Z M14.7,10.3 L15.0,10.0 L17.1,13.7 L16.8,14.0 Z M16.8,10.0 L17.1,10.3 L15.0,14.0 L14.7,13.7 Z"/>
+ </group>
+</vector>
diff --git a/android/app/src/main/res/drawable/ic_speed_175.xml b/android/app/src/main/res/drawable/ic_speed_175.xml
new file mode 100644
index 00000000..d8a962e3
--- /dev/null
+++ b/android/app/src/main/res/drawable/ic_speed_175.xml
@@ -0,0 +1,17 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="?attr/colorControlNormal">
+ <!-- "1.75x" in 7-segment style (compact) — scaled 1.4x -->
+ <group
+ android:scaleX="1.4"
+ android:scaleY="1.4"
+ android:pivotX="12"
+ android:pivotY="12">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M6.53,8.95 h0.75 v6.1 h-0.75 Z M8.7,14.5 h0.75 v0.75 h-0.75 Z M10.0,8.75 h2.2 v0.75 h-2.2 Z M11.85,9.15 h0.75 v2.65 h-0.75 Z M11.85,12.2 h0.75 v2.65 h-0.75 Z M13.3,8.75 h2.2 v0.75 h-2.2 Z M15.15,12.2 h0.75 v2.65 h-0.75 Z M13.3,14.5 h2.2 v0.75 h-2.2 Z M12.9,9.15 h0.75 v2.65 h-0.75 Z M13.3,11.625 h2.2 v0.75 h-2.2 Z M16.5,10.3 L16.8,10.0 L18.9,13.7 L18.6,14.0 Z M18.6,10.0 L18.9,10.3 L16.8,14.0 L16.5,13.7 Z"/>
+ </group>
+</vector>
diff --git a/android/app/src/main/res/drawable/ic_speed_200.xml b/android/app/src/main/res/drawable/ic_speed_200.xml
new file mode 100644
index 00000000..f6a7351f
--- /dev/null
+++ b/android/app/src/main/res/drawable/ic_speed_200.xml
@@ -0,0 +1,17 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="?attr/colorControlNormal">
+ <!-- "2.0x" in 7-segment style — scaled 1.4x -->
+ <group
+ android:scaleX="1.4"
+ android:scaleY="1.4"
+ android:pivotX="12"
+ android:pivotY="12">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M7.3,8.75 h2.2 v0.75 h-2.2 Z M9.15,9.15 h0.75 v2.65 h-0.75 Z M7.3,14.5 h2.2 v0.75 h-2.2 Z M6.9,12.2 h0.75 v2.65 h-0.75 Z M7.3,11.625 h2.2 v0.75 h-2.2 Z M10.3,14.5 h0.75 v0.75 h-0.75 Z M11.7,8.75 h2.2 v0.75 h-2.2 Z M13.55,9.15 h0.75 v2.65 h-0.75 Z M13.55,12.2 h0.75 v2.65 h-0.75 Z M11.7,14.5 h2.2 v0.75 h-2.2 Z M11.3,12.2 h0.75 v2.65 h-0.75 Z M11.3,9.15 h0.75 v2.65 h-0.75 Z M14.7,10.3 L15.0,10.0 L17.1,13.7 L16.8,14.0 Z M16.8,10.0 L17.1,10.3 L15.0,14.0 L14.7,13.7 Z"/>
+ </group>
+</vector>
diff --git a/android/app/src/main/res/drawable/ic_speed_250.xml b/android/app/src/main/res/drawable/ic_speed_250.xml
new file mode 100644
index 00000000..2e2742e5
--- /dev/null
+++ b/android/app/src/main/res/drawable/ic_speed_250.xml
@@ -0,0 +1,17 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="?attr/colorControlNormal">
+ <!-- "2.5x" in 7-segment style — scaled 1.4x -->
+ <group
+ android:scaleX="1.4"
+ android:scaleY="1.4"
+ android:pivotX="12"
+ android:pivotY="12">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M7.3,8.75 h2.2 v0.75 h-2.2 Z M9.15,9.15 h0.75 v2.65 h-0.75 Z M7.3,14.5 h2.2 v0.75 h-2.2 Z M6.9,12.2 h0.75 v2.65 h-0.75 Z M7.3,11.625 h2.2 v0.75 h-2.2 Z M10.3,14.5 h0.75 v0.75 h-0.75 Z M11.7,8.75 h2.2 v0.75 h-2.2 Z M13.55,12.2 h0.75 v2.65 h-0.75 Z M11.7,14.5 h2.2 v0.75 h-2.2 Z M11.3,9.15 h0.75 v2.65 h-0.75 Z M11.7,11.625 h2.2 v0.75 h-2.2 Z M14.7,10.3 L15.0,10.0 L17.1,13.7 L16.8,14.0 Z M16.8,10.0 L17.1,10.3 L15.0,14.0 L14.7,13.7 Z"/>
+ </group>
+</vector>
diff --git a/lib/main.dart b/lib/main.dart
index ec5102eb..64adabef 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -54,6 +54,7 @@ void main() async {
final info = await DeviceInfoPlugin().androidInfo;
ApiService.deviceManufacturer = info.manufacturer;
ApiService.deviceModel = info.model;
+ ApiService.deviceSdkInt = info.version.sdkInt;
} catch (_) {}
// Initialize log service (must be before other services so debugPrint is captured)
diff --git a/lib/providers/library_provider.dart b/lib/providers/library_provider.dart
index 36c91f04..4da5cf45 100644
--- a/lib/providers/library_provider.dart
+++ b/lib/providers/library_provider.dart
@@ -533,6 +533,7 @@ class LibraryProvider extends ChangeNotifier {
await ScopedPrefs.setString('last_selected_library', libraryId);
notifyListeners();
await loadPersonalizedView(force: true);
+ AndroidAutoService().refresh(force: true);
}
/// Fetch personalized home sections for the selected library.
diff --git a/lib/services/android_auto_service.dart b/lib/services/android_auto_service.dart
index d01e09e3..978c46fc 100644
--- a/lib/services/android_auto_service.dart
+++ b/lib/services/android_auto_service.dart
@@ -7,6 +7,7 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'api_service.dart';
import 'download_service.dart';
import 'progress_sync_service.dart';
+import 'scoped_prefs.dart';
// ─── Media ID scheme ─────────────────────────────────────────────────
//
@@ -167,6 +168,9 @@ class AndroidAutoService {
}
Future<String?> getDefaultLibraryId() async {
+ // Prefer the user's selected library (set in-app) over the server default
+ final selected = await ScopedPrefs.getString('last_selected_library');
+ if (selected != null) return selected;
final prefs = await SharedPreferences.getInstance();
return prefs.getString('default_library_id');
}
diff --git a/lib/services/api_service.dart b/lib/services/api_service.dart
index 6c582994..f4d077bc 100644
--- a/lib/services/api_service.dart
+++ b/lib/services/api_service.dart
@@ -31,6 +31,7 @@ class ApiService {
static String deviceManufacturer = '';
static String deviceModel = '';
static String deviceId = '';
+ static int deviceSdkInt = 0;
/// Generate or load a persistent unique device ID
static Future<void> initDeviceId() async {
diff --git a/lib/services/audio_player_service.dart b/lib/services/audio_player_service.dart
index 4b88a63a..a8a0122e 100644
--- a/lib/services/audio_player_service.dart
+++ b/lib/services/audio_player_service.dart
@@ -216,23 +216,75 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
// OnePlus/Oppo/Realme (ColorOS) renders notification media buttons in
// reverse order. Flip the controls so they end up visually correct.
+ // Only on API < 33 — on 33+ the system media player renders from
+ // MediaSession state and the OEM reversal doesn't apply.
static bool get _reversedNotificationControls {
+ if (ApiService.deviceSdkInt >= 33) return false;
final m = ApiService.deviceManufacturer.toLowerCase();
return m == 'oneplus' || m == 'oppo' || m == 'realme';
}
+ // Speed presets for Android Auto cycling (matches in-app presets)
+ static const _aaSpeedPresets = [0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.5];
+
PlaybackState _transformEvent(PlaybackEvent event) {
final playPause = _player.playing ? MediaControl.pause : MediaControl.play;
- final controls = _reversedNotificationControls
+
+ // Speed action first — Android Auto places the first custom action
+ // inline on the left of transport controls. Use per-speed drawables
+ // so the icon shows the actual speed value (7-segment style digits).
+ final speed = _player.speed;
+ final speedLabel = '${speed.toStringAsFixed(2)}x';
+ String speedIcon;
+ if ((speed - 0.75).abs() < 0.01) {
+ speedIcon = 'drawable/ic_speed_075';
+ } else if ((speed - 1.0).abs() < 0.01) {
+ speedIcon = 'drawable/ic_speed_100';
+ } else if ((speed - 1.25).abs() < 0.01) {
+ speedIcon = 'drawable/ic_speed_125';
+ } else if ((speed - 1.5).abs() < 0.01) {
+ speedIcon = 'drawable/ic_speed_150';
+ } else if ((speed - 1.75).abs() < 0.01) {
+ speedIcon = 'drawable/ic_speed_175';
+ } else if ((speed - 2.0).abs() < 0.01) {
+ speedIcon = 'drawable/ic_speed_200';
+ } else if ((speed - 2.5).abs() < 0.01) {
+ speedIcon = 'drawable/ic_speed_250';
+ } else {
+ speedIcon = 'drawable/ic_speed'; // Generic fallback
+ }
+ final speedAction = MediaControl.custom(
+ androidIcon: speedIcon,
+ label: speedLabel,
+ name: 'cycleSpeed',
+ );
+
+ // Transport controls — OnePlus/Oppo/Realme (API < 33) render
+ // notification buttons in reverse order, so pre-flip for those devices.
+ final transport = _reversedNotificationControls
? [MediaControl.fastForward, playPause, MediaControl.rewind]
: [MediaControl.rewind, playPause, MediaControl.fastForward];
+
+ // Speed goes AFTER transport — on API 33+ audio_service converts
+ // rewind/forward to custom actions, and AA places custom actions in
+ // alternating slots outward from play/pause. With transport first,
+ // rewind lands left of play (slot 2), forward right (slot 4), and
+ // speed on the far left (slot 1) — giving [speed][rw][play][ff].
+ final controls = <MediaControl>[
+ ...transport,
+ speedAction,
+ ];
+
return PlaybackState(
controls: controls,
systemActions: const {
MediaAction.seek,
MediaAction.seekForward,
MediaAction.seekBackward,
+ MediaAction.skipToQueueItem,
},
+ // Notification compact: indices into nativeActions (custom actions are
+ // separated out on the platform side, so standard controls are always 0-2).
androidCompactActionIndices: const [0, 1, 2],
processingState: const {
ProcessingState.idle: AudioProcessingState.idle,
@@ -246,10 +298,31 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
bufferedPosition: _player.bufferedPosition,
// Report actual speed — always
speed: _player.speed,
- queueIndex: event.currentIndex,
+ queueIndex: _safeCurrentChapterIndex(),
);
}
+ /// Return the index of the chapter containing the current playback position,
+ /// or null if there are no chapters. Used as queueIndex so Android Auto
+ /// highlights and scrolls to the active chapter in the queue view.
+ int? _safeCurrentChapterIndex() {
+ try {
+ if (_service == null || _service!.chapters.isEmpty) return null;
+ final posSec = _player.position.inMilliseconds / 1000.0;
+ final chapters = _service!.chapters;
+ for (int i = 0; i < chapters.length; i++) {
+ final ch = chapters[i] as Map<String, dynamic>;
+ final start = (ch['start'] as num?)?.toDouble() ?? 0;
+ final end = (ch['end'] as num?)?.toDouble() ?? _service!.totalDuration;
+ if (posSec >= start && posSec < end) return i;
+ }
+ return null;
+ } catch (e) {
+ debugPrint('[Handler] _safeCurrentChapterIndex error: $e');
+ return null;
+ }
+ }
+
@override
Future<void> play() async {
debugPrint('[Handler] play() called — routing to service');
@@ -398,6 +471,62 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
@override
Future<void> setSpeed(double speed) => _player.setSpeed(speed);
+ @override
+ Future<dynamic> customAction(String name, [Map<String, dynamic>? extras]) async {
+ debugPrint('[Handler] customAction($name)');
+ switch (name) {
+ case 'nextChapter':
+ if (_service != null) await _service!.skipToNextChapter();
+ break;
+ case 'previousChapter':
+ if (_service != null) await _service!.skipToPreviousChapter();
+ break;
+ case 'cycleSpeed':
+ if (_service != null) {
+ final current = _service!.speed;
+ // Find next preset above current speed, or wrap to first
+ final next = _aaSpeedPresets.cast<double>().firstWhere(
+ (s) => s > current + 0.01,
+ orElse: () => _aaSpeedPresets.first,
+ );
+ await _service!.setSpeed(next);
+ }
+ break;
+ }
+ }
+
+ // ─── Chapter queue (for Android Auto queue button) ─────────────────
+
+ /// Populate the MediaSession queue with chapter entries so AA shows
+ /// a chapter list via the queue button on the Now Playing screen.
+ void updateChaptersQueue(List<dynamic> chapters) {
+ if (chapters.isEmpty) {
+ queue.add(const []);
+ return;
+ }
+ final items = chapters.asMap().entries.map((e) {
+ final ch = e.value as Map<String, dynamic>;
+ final start = (ch['start'] as num?)?.toDouble() ?? 0;
+ final end = (ch['end'] as num?)?.toDouble() ?? 0;
+ return MediaItem(
+ id: 'chapter_${e.key}',
+ title: ch['title'] as String? ?? 'Chapter ${e.key + 1}',
+ duration: Duration(milliseconds: ((end - start) * 1000).round()),
+ );
+ }).toList();
+ queue.add(items);
+ }
+
+ @override
+ Future<void> skipToQueueItem(int index) async {
+ debugPrint('[Handler] skipToQueueItem($index)');
+ if (_service == null) return;
+ final chapters = _service!.chapters;
+ if (index < 0 || index >= chapters.length) return;
+ final start = (chapters[index]['start'] as num?)?.toDouble() ?? 0;
+ await _service!.seekTo(Duration(milliseconds: (start * 1000).round()));
+ }
+
// ─── Android Auto browse tree ──────────────────────────────────────
final _autoService = AndroidAutoService();
@@ -604,6 +733,7 @@ class AudioPlayerService extends ChangeNotifier {
void updateChapters(List<dynamic> chapters) {
_chapters = chapters;
+ _handler?.updateChaptersQueue(chapters);
notifyListeners();
}
bool get hasBook => _currentItemId != null;
@@ -837,6 +967,7 @@ class AudioPlayerService extends ChangeNotifier {
_currentCoverUrl = coverUrl;
_totalDuration = totalDuration;
_chapters = chapters;
+ _handler?.updateChaptersQueue(chapters);
// New book = fresh session — clear any auto sleep dismissal
SleepTimerService().resetDismiss();
notifyListeners();
@@ -1452,6 +1583,7 @@ class AudioPlayerService extends ChangeNotifier {
// Clear state (player already stopped at top of method)
_clearState();
_chapters = [];
+ _handler?.updateChaptersQueue(const []);
_isCompletingBook = false;
notifyListeners();
}
@@ -1685,6 +1817,7 @@ class AudioPlayerService extends ChangeNotifier {
await _player?.stop();
_clearState();
_chapters = [];
+ _handler?.updateChaptersQueue(const []);
// Cancel sleep timer when playback is stopped
if (SleepTimerService().isActive) {
SleepTimerService().cancel();
@@ -1704,6 +1837,7 @@ class AudioPlayerService extends ChangeNotifier {
await _player?.stop();
_clearState();
_chapters = [];
+ _handler?.updateChaptersQueue(const []);
}
@override