Do not trigger next/prev event handlers when Cmd (meta) is pressed

This commit is contained in:
Deluan 2021-02-05 13:03:36 -05:00
parent bb6197360b
commit 4b373560c6
1 changed files with 12 additions and 6 deletions

View File

@ -93,12 +93,18 @@ const Player = () => {
(audioInstance.volume = Math.min(1, audioInstance.volume + 0.1)),
VOL_DOWN: () =>
(audioInstance.volume = Math.max(0, audioInstance.volume - 0.1)),
PREV_SONG: useCallback(() => {
if (prevSong()) audioInstance && audioInstance.playPrev()
}, [prevSong]),
NEXT_SONG: useCallback(() => {
if (nextSong()) audioInstance && audioInstance.playNext()
}, [nextSong]),
PREV_SONG: useCallback(
(e) => {
if (!e.metaKey && prevSong()) audioInstance && audioInstance.playPrev()
},
[prevSong]
),
NEXT_SONG: useCallback(
(e) => {
if (!e.metaKey && nextSong()) audioInstance && audioInstance.playNext()
},
[nextSong]
),
}
const defaultOptions = {