MacOS – Next/Prev buttons stopped working for the Music app on the 2015 MacBook Air

headphonesitunesmacmacosmusic

Normally, when I press the button on my 3.5mm headphones, the Music app would pop up and start playing music. When a song was playing, I could pause it by clicking this button. However, since a recent reboot, this doesn't work anymore. The prev, next and pause buttons on the keyboard (f7, f8, and f9) also don't work anymore although they used to work. It is not because of the update to Catalina, because it has worked in Catalina before. Playing and pausing music on Youtube using this button still works.

Is this an update of the Music app (that replaced iTunes)? Is it some setting? Is there any way I can get it to work again? I really like being able to start the music without having to open the Music app and start a track.

To clarify:

  • Even if the Music app is active, it does not work
  • Both headphone button and keyboard buttons don't work anymore, although they used to work

Best Answer

Here's an imperfect potential solution (depends on how you want to use the feature) – see problem 3 below.

I created an applescript that uses keystrokes to tell apple music to play/pause. This way, you can just use automator to trigger it based on shortcuts (you can similarly bind fast forward and rewind).

Script is below:

on run {input, parameters}

    tell application "System Events"
        tell application "Music" to activate
        key code 49
        key code 48 using {command down}
    end tell

    return input
end run

Pop this into an automator workflow using the "Run AppleScript" action and you can create a shortcut. I'm having issues doing this now, but it's something you can probably research. I use keyboard maestro, which makes setting up shortcuts significantly easier.

To change to rewind and fast forward, just change the line key code 49 to key code 123 and key code 124 respectively (this is left and right arrow keys)

There are a few problems:

  1. you may want to hide music instead of tabbing back to your original program. In that case, just replace key code 48 using {command down} with set visible of process "Music" to false and it'll hide the progam
  2. you can't actually use the f8 key as a shortcut, but you could maybe bind it to something like command 8. You could also probably use Karabiner to rebind the f8 key to something else
  3. This doesn't really fix the "why" of what's going on. I still don't know what's happening for sure, but it is a way for you to get it up and running (I still think you should try messing around with Karabiner to change the f8 key to like the keycode for play/pause. It may add clarity to what's happening).