Set up global shortcuts for media keys (next, prev, play/pause)

Solution 1:

This solution is a bit of a workaround, but I think that it should work for you.

First, you can write some AppleScripts that will perform the actions Next, Prev., and Play/Pause. I found some examples here. If you are on macOS Catalina, you will need to replace "iTunes" with "Music", unless you only use Spotify and don't want to check for other open applications.

Next, you can create a Quick Action (also known as a service) in Automator. I found some instructions to do that here.

For each AppleScript (Next, Prev, Play/Pause), you can either save it as an application, and set the service to open that application, or you can have your service run the AppleScript directly by using the Run AppleScript variable in Automator.

When you save each service, give it a name (like next, prev, and play), as that will be what shows up in the shortcuts menu.

Now that you have 3 services, you can go to System Preferences -> Keyboard -> Shortcuts -> Services. You can now set a keyboard shortcut to run each service, which in turn should run the AppleScript to perform the Media Action you want. The services you just made should be in the General section, which is at the very bottom of the list for me.

Solution 2:

I had a similar problem, using a basic, non-apple, USB keyboard pressing F8 wouldn't pause my music whether or not I checked the "Use F1, F2, etc. keys as standard function keys" option.

I spent a while trying to get Applescripts to control Chrome but it was more complicated than controlling Spotify.

What ended up helping was installing Karabiner-Elements. Without any extra configuration, now pressing F8 works to control media.