From fabdfd5517f805727e50cb25f718564ea68a23af Mon Sep 17 00:00:00 2001 From: Greg Lorenzen Date: Tue, 26 Nov 2024 04:04:44 +0000 Subject: [PATCH 1/4] Add player settings modal to PlayerUi --- client/components/player/PlayerUi.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 From 53fdb5273ca215b2c257857ddcf660eb08cb6777 Mon Sep 17 00:00:00 2001 From: Greg Lorenzen Date: Tue, 26 Nov 2024 04:04:55 +0000 Subject: [PATCH 2/4] Remove player settings modal from MediaPlayerContainer --- client/components/app/MediaPlayerContainer.vue | 4 ---- 1 file changed, 4 deletions(-) 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, From 2ba0f9157d1591e930e311943862278f65c91557 Mon Sep 17 00:00:00 2001 From: advplyr Date: Tue, 26 Nov 2024 17:03:01 -0600 Subject: [PATCH 3/4] Update share player to load user settings --- client/components/modals/PlayerSettingsModal.vue | 13 ++++++++++--- client/pages/share/_slug.vue | 5 ++++- 2 files changed, 14 insertions(+), 4 deletions(-) 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/pages/share/_slug.vue b/client/pages/share/_slug.vue index cd990072..89e159c1 100644 --- a/client/pages/share/_slug.vue +++ b/client/pages/share/_slug.vue @@ -126,7 +126,8 @@ 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 @@ -248,6 +249,8 @@ export default { } }, mounted() { + this.$store.dispatch('user/loadUserSettings') + this.resize() window.addEventListener('resize', this.resize) window.addEventListener('keydown', this.keyDown) From 718d8b599993c676762dae07bd09a73c65971490 Mon Sep 17 00:00:00 2001 From: advplyr Date: Tue, 26 Nov 2024 17:05:50 -0600 Subject: [PATCH 4/4] Update jump backward amount for share player --- client/pages/share/_slug.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/pages/share/_slug.vue b/client/pages/share/_slug.vue index 89e159c1..7ddb994c 100644 --- a/client/pages/share/_slug.vue +++ b/client/pages/share/_slug.vue @@ -132,7 +132,8 @@ export default { 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