Can AirPods' double-tap to Play/Pause be made to work in other macOS applications than iTunes?
I don't know much about Macs but this is how I got it to work with VLC (generic options described below also):


Set the AirPods bluetooth options to open Siri on double tap
Have something running in the background checking if Siri is open
If it is open, execute Play/Pause and close it, then go back to checking if Siri is open


These are the two scripts required to get the above working:

MacBook-Pro:~ user$ cat airpods_controller
#!/bin/sh
while :; do
    pid=$(ps x |grep Siri.app|grep -v grep|awk '{print $1}')
    if [ -n "$pid" ]; then
        kill -9 $pid
        osascript -e 'tell application "VLC" to play'
    fi
    sleep .5
done

MacBook-Pro:~ user$ cat airpods_controller_launcher 
#!/bin/sh
ps x |grep airpods_controller|wc -l|grep 2
if [ $? -eq 0 ]; then
    nohup ./airpods_controller &amp;
fi


To have it start automatically, just add airpods_controller_launcher to your startup items under Mac Settings and it's hands off from there. Check the checkbox to make it hide on startup and in Terminal options, set the terminal to close on success if you don't want the window to hang around.

To get it working by simulating media keys instead of osascript (to be more generic), the following looks like it would work:
https://stackoverflow.com/a/13396296/494354

To get it working with Chrome and some other apps, this may help: https://github.com/beardedspice/beardedspice