-
@@ -128,7 +128,7 @@
-
+
play_arrow
{{ isStreaming ? 'Playing' : 'Play' }}
@@ -429,14 +429,14 @@ export default {
message: `Start playback for "${this.title}" at ${this.$secondsToTimestamp(bookmark.time)}?`,
callback: (confirmed) => {
if (confirmed) {
- this.startStream(bookmark.time)
+ this.playItem(bookmark.time)
}
},
type: 'yesNo'
}
this.$store.commit('globals/setConfirmPrompt', payload)
} else {
- this.startStream(bookmark.time)
+ this.playItem(bookmark.time)
}
this.showBookmarksModal = false
},
@@ -515,21 +515,37 @@ export default {
this.$toast.error(`Failed to mark as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`)
})
},
- startStream(startTime = null) {
+ playItem(startTime = null) {
var episodeId = null
+ const queueItems = []
if (this.isPodcast) {
- var episode = this.podcastEpisodes.find((ep) => {
+ var episodeIndex = this.podcastEpisodes.findIndex((ep) => {
var podcastProgress = this.$store.getters['user/getUserMediaProgress'](this.libraryItemId, ep.id)
return !podcastProgress || !podcastProgress.isFinished
})
- if (!episode) episode = this.podcastEpisodes[0]
- episodeId = episode.id
+ if (episodeIndex < 0) episodeIndex = 0
+
+ episodeId = this.podcastEpisodes[episodeIndex].id
+
+ for (let i = episodeIndex; i < this.podcastEpisodes.length; i++) {
+ const episode = this.podcastEpisodes[i]
+ const audioFile = episode.audioFile
+ queueItems.push({
+ libraryItemId: this.libraryItemId,
+ episodeId: episode.id,
+ title: episode.title,
+ subtitle: this.title,
+ duration: audioFile.duration || null,
+ coverPath: this.libraryItem.media.coverPath || null
+ })
+ }
}
this.$eventBus.$emit('play-item', {
libraryItemId: this.libraryItem.id,
episodeId,
- startTime
+ startTime,
+ queueItems
})
},
editClick() {
diff --git a/client/players/PlayerHandler.js b/client/players/PlayerHandler.js
index f50c3aaf..43ce84fa 100644
--- a/client/players/PlayerHandler.js
+++ b/client/players/PlayerHandler.js
@@ -133,6 +133,8 @@ export default class PlayerHandler {
// TODO: Add listening time between last sync and now?
this.sendProgressSync(currentTime)
+
+ this.ctx.mediaFinished(this.libraryItemId, this.episodeId)
}
playerStateChange(state) {
diff --git a/client/store/globals.js b/client/store/globals.js
index 8a5edc36..21a31d5a 100644
--- a/client/store/globals.js
+++ b/client/store/globals.js
@@ -46,6 +46,14 @@ export const getters = {
return `http://localhost:3333/api/items/${libraryItem.id}/cover?token=${userToken}&ts=${lastUpdate}`
}
return `/api/items/${libraryItem.id}/cover?token=${userToken}&ts=${lastUpdate}`
+ },
+ getLibraryItemCoverSrcById: (state, getters, rootState, rootGetters) => (libraryItemId, placeholder = '/book_placeholder.jpg') => {
+ if (!libraryItemId) return placeholder
+ var userToken = rootGetters['user/getToken']
+ if (process.env.NODE_ENV !== 'production') { // Testing
+ return `http://localhost:3333/api/items/${libraryItemId}/cover?token=${userToken}`
+ }
+ return `/api/items/${libraryItemId}/cover?token=${userToken}`
}
}
diff --git a/client/store/index.js b/client/store/index.js
index df313576..1cff645d 100644
--- a/client/store/index.js
+++ b/client/store/index.js
@@ -9,6 +9,7 @@ export const state = () => ({
streamLibraryItem: null,
streamEpisodeId: null,
streamIsPlaying: false,
+ playerQueueItems: [],
playerIsFullscreen: false,
editModalTab: 'details',
showEditModal: false,
@@ -144,14 +145,19 @@ export const mutations = {
state.streamLibraryItem = null
state.streamEpisodeId = null
state.streamIsPlaying = false
+ state.playerQueueItems = []
} else {
state.streamLibraryItem = payload.libraryItem
state.streamEpisodeId = payload.episodeId || null
+ state.playerQueueItems = payload.queueItems || []
}
},
setIsPlaying(state, isPlaying) {
state.streamIsPlaying = isPlaying
},
+ setPlayerQueueItems(state, items) {
+ state.playerQueueItems = items || []
+ },
showEditModal(state, libraryItem) {
state.editModalTab = 'details'
state.selectedLibraryItem = libraryItem
diff --git a/client/tailwind.config.js b/client/tailwind.config.js
index 6a1419d9..39092556 100644
--- a/client/tailwind.config.js
+++ b/client/tailwind.config.js
@@ -11,6 +11,7 @@ module.exports = {
safelist: [
'bg-success',
'bg-red-600',
+ 'bg-yellow-400',
'text-green-500',
'py-1.5',
'bg-info',