7

In macOS, it's possible to assign AirPod double-tap to Play/Pause audio (under Bluetooth options; instead of invoking Siri).

But for some reason double-tap Play/Pause only works with iTunes.

If you use the Play/Pause button on the Mac keyboard, or even send it via the wired EarPods, the command command can be intercepted by other applications like VLC. I also use a Chrome extension called StreamKeys whereby the Play/Pause button can control playback on popular audio and video streaming sites.

Question: Is there a way to make the AirPods control system-wide Play/Pause? If no simple solution exists, could this be done some elaborate way via scripting?

4

It works just fine with applications like

  • QuickTime Player.app
  • the Lynda.com app from the Mac App Store
  • YouTube videos played in Safari

However, it does not work with these applications:

  • QuickTime Player 7
  • Vox (audio player)
  • VLC
  • MplayerX
  • I'm accepting your answer for the time being. It seems to suggest to me that some kind of double-tap Play/Pause support for third-party apps is possible, but perhaps developers must carry out special implementations for it to work. – Winterflags Jul 9 '17 at 14:40
  • also works with the Spotify desktop app – user5359531 May 22 '18 at 16:44
4

I don't know much about Macs but this is how I got it to work with VLC (generic options described below also):

  1. Set the AirPods bluetooth options to open Siri on double tap
  2. Have something running in the background checking if Siri is open
  3. 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 &
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .