diff --git a/client/components/app/MediaPlayerContainer.vue b/client/components/app/MediaPlayerContainer.vue index ee47165a..1a2b1d30 100644 --- a/client/components/app/MediaPlayerContainer.vue +++ b/client/components/app/MediaPlayerContainer.vue @@ -156,7 +156,7 @@ export default { return this.mediaMetadata.authors || [] }, libraryId() { - return this.streamLibraryItem ? this.streamLibraryItem.libraryId : null + return this.streamLibraryItem?.libraryId || null }, totalDurationPretty() { // Adjusted by playback rate diff --git a/client/layouts/default.vue b/client/layouts/default.vue index 9121561e..33e7aa15 100644 --- a/client/layouts/default.vue +++ b/client/layouts/default.vue @@ -183,7 +183,7 @@ export default { this.$store.commit('libraries/updateFilterDataWithItem', libraryItem) }, libraryItemUpdated(libraryItem) { - if (this.$store.state.selectedLibraryItem && this.$store.state.selectedLibraryItem.id === libraryItem.id) { + if (this.$store.state.selectedLibraryItem?.id === libraryItem.id) { this.$store.commit('setSelectedLibraryItem', libraryItem) if (this.$store.state.globals.selectedEpisode && libraryItem.mediaType === 'podcast') { const episode = libraryItem.media.episodes.find((ep) => ep.id === this.$store.state.globals.selectedEpisode.id) @@ -192,6 +192,9 @@ export default { } } } + if (this.$store.state.streamLibraryItem?.id === libraryItem.id) { + this.$store.commit('updateStreamLibraryItem', libraryItem) + } this.$eventBus.$emit(`${libraryItem.id}_updated`, libraryItem) this.$store.commit('libraries/updateFilterDataWithItem', libraryItem) }, diff --git a/client/store/index.js b/client/store/index.js index 2f2201b6..b9feec8d 100644 --- a/client/store/index.js +++ b/client/store/index.js @@ -171,6 +171,10 @@ export const mutations = { state.playerQueueItems = payload.queueItems || [] } }, + updateStreamLibraryItem(state, libraryItem) { + if (!libraryItem) return + state.streamLibraryItem = libraryItem + }, setIsPlaying(state, isPlaying) { state.streamIsPlaying = isPlaying },