diff --git a/client/components/app/MediaPlayerContainer.vue b/client/components/app/MediaPlayerContainer.vue index 1a19f301..ed8971f7 100644 --- a/client/components/app/MediaPlayerContainer.vue +++ b/client/components/app/MediaPlayerContainer.vue @@ -53,7 +53,6 @@ @showBookmarks="showBookmarks" @showSleepTimer="showSleepTimerModal = true" @showPlayerQueueItems="showPlayerQueueItemsModal = true" - @showPlayerSettings="showPlayerSettingsModal = true" /> @@ -61,8 +60,6 @@ - - @@ -81,7 +78,6 @@ export default { currentTime: 0, showSleepTimerModal: false, showPlayerQueueItemsModal: false, - showPlayerSettingsModal: false, sleepTimerSet: false, sleepTimerRemaining: 0, sleepTimerType: null, diff --git a/client/components/modals/PlayerSettingsModal.vue b/client/components/modals/PlayerSettingsModal.vue index ec178d9c..88cb91e1 100644 --- a/client/components/modals/PlayerSettingsModal.vue +++ b/client/components/modals/PlayerSettingsModal.vue @@ -59,12 +59,19 @@ export default { setJumpBackwardAmount(val) { this.jumpBackwardAmount = val this.$store.dispatch('user/updateUserSettings', { jumpBackwardAmount: val }) + }, + settingsUpdated() { + this.useChapterTrack = this.$store.getters['user/getUserSetting']('useChapterTrack') + this.jumpForwardAmount = this.$store.getters['user/getUserSetting']('jumpForwardAmount') + this.jumpBackwardAmount = this.$store.getters['user/getUserSetting']('jumpBackwardAmount') } }, mounted() { - this.useChapterTrack = this.$store.getters['user/getUserSetting']('useChapterTrack') - this.jumpForwardAmount = this.$store.getters['user/getUserSetting']('jumpForwardAmount') - this.jumpBackwardAmount = this.$store.getters['user/getUserSetting']('jumpBackwardAmount') + this.settingsUpdated() + this.$eventBus.$on('user-settings', this.settingsUpdated) + }, + beforeDestroy() { + this.$eventBus.$off('user-settings', this.settingsUpdated) } } diff --git a/client/components/player/PlayerUi.vue b/client/components/player/PlayerUi.vue index 92179580..d4fdb8f7 100644 --- a/client/components/player/PlayerUi.vue +++ b/client/components/player/PlayerUi.vue @@ -37,7 +37,7 @@ - @@ -64,6 +64,8 @@ + + @@ -96,6 +98,7 @@ export default { audioEl: null, seekLoading: false, showChaptersModal: false, + showPlayerSettingsModal: false, currentTime: 0, duration: 0 } @@ -315,6 +318,9 @@ export default { if (!this.chapters.length) return this.showChaptersModal = !this.showChaptersModal }, + showPlayerSettings() { + this.showPlayerSettingsModal = !this.showPlayerSettingsModal + }, init() { this.playbackRate = this.$store.getters['user/getUserSetting']('playbackRate') || 1 diff --git a/client/pages/share/_slug.vue b/client/pages/share/_slug.vue index cd990072..7ddb994c 100644 --- a/client/pages/share/_slug.vue +++ b/client/pages/share/_slug.vue @@ -126,12 +126,14 @@ export default { if (!this.localAudioPlayer || !this.hasLoaded) return const currentTime = this.localAudioPlayer.getCurrentTime() const duration = this.localAudioPlayer.getDuration() - this.seek(Math.min(currentTime + 10, duration)) + const jumpForwardAmount = this.$store.getters['user/getUserSetting']('jumpForwardAmount') || 10 + this.seek(Math.min(currentTime + jumpForwardAmount, duration)) }, jumpBackward() { if (!this.localAudioPlayer || !this.hasLoaded) return const currentTime = this.localAudioPlayer.getCurrentTime() - this.seek(Math.max(currentTime - 10, 0)) + const jumpBackwardAmount = this.$store.getters['user/getUserSetting']('jumpBackwardAmount') || 10 + this.seek(Math.max(currentTime - jumpBackwardAmount, 0)) }, setVolume(volume) { if (!this.localAudioPlayer || !this.hasLoaded) return @@ -248,6 +250,8 @@ export default { } }, mounted() { + this.$store.dispatch('user/loadUserSettings') + this.resize() window.addEventListener('resize', this.resize) window.addEventListener('keydown', this.keyDown)