mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2025-12-24 11:59:30 +00:00
player: add chapter skip buttons
This commit is contained in:
parent
6557e63a28
commit
36509913f2
4 changed files with 58 additions and 53 deletions
|
|
@ -14,13 +14,7 @@ BookExpanded? currentlyPlayingBook(CurrentlyPlayingBookRef ref) {
|
|||
@riverpod
|
||||
BookChapter? currentPlayingChapter(CurrentPlayingChapterRef ref) {
|
||||
final player = ref.watch(audiobookPlayerProvider);
|
||||
// get the current timestamp
|
||||
final currentTimestamp = player.position;
|
||||
// get the chapter that contains the current timestamp
|
||||
return player.book?.chapters.firstWhere(
|
||||
(element) =>
|
||||
element.start <= currentTimestamp && element.end >= currentTimestamp,
|
||||
);
|
||||
return player.currentChapter;
|
||||
}
|
||||
|
||||
/// provides the book metadata of the currently playing book
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue