Easy way to play current audiobook

This patch implements a generic way of re-opening the player for the
book you last listened to. This is especially handy when first opening
the app and you can restart playback with a single click.

The player is opened only if no other book is already open in the
player. It will not overwrite or replace playbacks or player already in
progress.

The player is opened paused. No automatic playback since that could be
really annoying.

This closes #494
This commit is contained in:
Lars Kiesow 2023-02-11 22:57:06 +01:00
parent 5e0c740f02
commit ec704bf501
No known key found for this signature in database
GPG key ID: 5DAFE8D9C823CE73
2 changed files with 11 additions and 1 deletions

View file

@ -247,6 +247,15 @@ export default {
return cat
})
// If we don't already have a player open
// Try opening the first book from continue-listening without playing it
if (!this.$store.state.playerLibraryItemId) {
const lastListening = categories.filter((cat) => cat.id === 'continue-listening')[0]?.entities?.[0]?.id
if (lastListening) {
this.$eventBus.$emit('play-item', { libraryItemId: lastListening, paused: true })
}
}
// Only add the local shelf with the same media type
const localShelves = localCategories.filter((cat) => cat.type === this.currentLibraryMediaType && !cat.localOnly)
this.shelves.push(...localShelves)