From d579677f2e695a67b93c7c2b904e13ef4ae09e4d Mon Sep 17 00:00:00 2001 From: Phan An Date: Mon, 18 Mar 2024 18:51:51 +0100 Subject: [PATCH] feat: volume and seek shortcuts --- docs/usage/web-interface.md | 5 ++++ .../js/components/layout/app-footer/index.vue | 6 ++--- .../assets/js/components/ui/VolumeSlider.vue | 20 +++++++------- .../js/components/utils/HotkeyListener.vue | 8 +++++- .../assets/js/services/playbackService.ts | 6 +++++ resources/assets/js/services/volumeManager.ts | 26 ++++++++++++++++--- 6 files changed, 52 insertions(+), 19 deletions(-) diff --git a/docs/usage/web-interface.md b/docs/usage/web-interface.md index 405e974c..9297e478 100644 --- a/docs/usage/web-interface.md +++ b/docs/usage/web-interface.md @@ -137,6 +137,11 @@ or a textarea. * j plays the next song in queue * k plays the previous song in queue * l marks/unmarks the current song as favorite +* seeks forward 10 seconds +* seeks backward 10 seconds +* increases volume by 10% +* decreases volume by 10% +* m mutes/unmutes * Cmd/Ctrl+a selects all songs in the current song-list screen when the list is focused * Delete removes selected song(s) from the current queue/playlist diff --git a/resources/assets/js/components/layout/app-footer/index.vue b/resources/assets/js/components/layout/app-footer/index.vue index 52de0afd..1dd119c6 100644 --- a/resources/assets/js/components/layout/app-footer/index.vue +++ b/resources/assets/js/components/layout/app-footer/index.vue @@ -23,7 +23,7 @@ import { computed, nextTick, ref, watch } from 'vue' import { eventBus, isAudioContextSupported, requireInjection } from '@/utils' import { CurrentSongKey } from '@/symbols' import { artistStore, preferenceStore } from '@/stores' -import { audioService, playbackService, volumeManager } from '@/services' +import { audioService, playbackService } from '@/services' import AudioPlayer from '@/components/layout/app-footer/AudioPlayer.vue' import SongInfo from '@/components/layout/app-footer/FooterSongInfo.vue' @@ -57,16 +57,14 @@ const styles = computed(() => { const initPlaybackRelatedServices = async () => { const plyrWrapper = document.querySelector('.plyr') - const volumeInput = document.querySelector('#volumeInput') - if (!plyrWrapper || !volumeInput) { + if (!plyrWrapper) { await nextTick() await initPlaybackRelatedServices() return } playbackService.init(plyrWrapper) - volumeManager.init(volumeInput) isAudioContextSupported && audioService.init(playbackService.player.media) } diff --git a/resources/assets/js/components/ui/VolumeSlider.vue b/resources/assets/js/components/ui/VolumeSlider.vue index bf655c9c..5563551e 100644 --- a/resources/assets/js/components/ui/VolumeSlider.vue +++ b/resources/assets/js/components/ui/VolumeSlider.vue @@ -23,14 +23,13 @@ @@ -38,10 +37,12 @@