Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desktop media buttons should play/pause/mute and navigate tracks. #22

Open
OrderAndCh4oS opened this issue Jun 9, 2021 · 1 comment

Comments

@OrderAndCh4oS
Copy link
Owner

Implement something like this

function onKeyDown(event) {
  if (event.code === 'MediaPlayPause') alert('Play/Pause');
  if (event.code === 'MediaStop') alert('Stop');
  if (event.code === 'MediaTrackPrevious') alert('Previous Track');
  if (event.code === 'MediaTrackNext') alert('Next Track');    
  if (event.code === 'VolumeUp') alert('Volume Up');
  if (event.code === 'VolumeDown') alert('Volume Down');
  if (event.code === 'VolumeMute') alert('Volume Mute');
}
@lauzaki
Copy link
Collaborator

lauzaki commented Jul 5, 2021

On macbook, if the "Use F1, F2, etc. keys as standard" option is unticked in Keyboard preferences,
then the media keys are not triggering the onKeyDown event.
However, the play/pause (F8) key is working once a track is playing.
(but the play/pause icon would not update)

If the option is unticked, there are other problems on F7

If someone knows how to handle the mac media keys (prev, play/pause, next), that would help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants