diff --git a/BookPlayer/Player/PlayerManager.swift b/BookPlayer/Player/PlayerManager.swift index 7d70f24a..54ee0c58 100755 --- a/BookPlayer/Player/PlayerManager.swift +++ b/BookPlayer/Player/PlayerManager.swift @@ -444,7 +444,8 @@ final class PlayerManager: NSObject, PlayerManagerProtocol { if currentTime >= currentItem.currentChapter.end || currentTime < currentItem.currentChapter.start, let newChapter = currentItem.getChapter(at: currentTime), - newChapter != currentItem.currentChapter + newChapter != currentItem.currentChapter, + !currentItem.isBoundBook || newChapter.chapterOffset != 0 { /// Avoid setting the same chapter, as it would publish an update event currentItem.currentChapter = newChapter diff --git a/Shared/Services/PlaybackService.swift b/Shared/Services/PlaybackService.swift index fe0eb953..2541b0a6 100644 --- a/Shared/Services/PlaybackService.swift +++ b/Shared/Services/PlaybackService.swift @@ -199,7 +199,7 @@ public final class PlaybackService: PlaybackServiceProtocol { func getPlayableChapters(book: SimpleLibraryItem) throws -> [PlayableChapter] { guard - let chapters = self.libraryService.getChapters(from: book.relativePath) + var chapters = self.libraryService.getChapters(from: book.relativePath) else { throw BookPlayerError.runtimeError( String.localizedStringWithFormat( @@ -209,6 +209,9 @@ public final class PlaybackService: PlaybackServiceProtocol { ) } + /// Ignore chapters that don't have the duration set properly + chapters = chapters.filter { $0.duration > 0 } + guard !chapters.isEmpty else { return [ PlayableChapter(