From af7e3a03f029b60f5573c89d7e4d0d0b10bec687 Mon Sep 17 00:00:00 2001 From: advplyr Date: Wed, 13 Jul 2022 19:38:34 -0500 Subject: [PATCH] Fix:Audio player when using chapter track then playing an item without chapters --- client/components/app/StreamContainer.vue | 4 ++++ client/components/player/PlayerUi.vue | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/client/components/app/StreamContainer.vue b/client/components/app/StreamContainer.vue index 5775cf27..cdd144fb 100644 --- a/client/components/app/StreamContainer.vue +++ b/client/components/app/StreamContainer.vue @@ -377,6 +377,10 @@ export default { libraryItem, episodeId }) + this.$nextTick(() => { + if (this.$refs.audioPlayer) this.$refs.audioPlayer.checkUpdateChapterTrack() + }) + this.playerHandler.load(libraryItem, episodeId, true, this.initialPlaybackRate) }, pauseItem() { diff --git a/client/components/player/PlayerUi.vue b/client/components/player/PlayerUi.vue index 608f33ca..c23c9f9f 100644 --- a/client/components/player/PlayerUi.vue +++ b/client/components/player/PlayerUi.vue @@ -226,6 +226,13 @@ export default { }) this.updateTimestamp() }, + checkUpdateChapterTrack() { + // Changing media in player may not have chapters + if (!this.chapters.length && this.useChapterTrack) { + this.useChapterTrack = false + if (this.$refs.trackbar) this.$refs.trackbar.setUseChapterTrack(this.useChapterTrack) + } + }, seek(time) { this.$emit('seek', time) }, @@ -286,7 +293,10 @@ export default { }, init() { this.playbackRate = this.$store.getters['user/getUserSetting']('playbackRate') || 1 - this.useChapterTrack = this.$store.getters['user/getUserSetting']('useChapterTrack') || false + + var _useChapterTrack = this.$store.getters['user/getUserSetting']('useChapterTrack') || false + this.useChapterTrack = this.chapters.length ? _useChapterTrack : false + if (this.$refs.trackbar) this.$refs.trackbar.setUseChapterTrack(this.useChapterTrack) this.$emit('setPlaybackRate', this.playbackRate) },