How to pause music when headphones are unplugged on Windows
Create a KeyRoutines routine with the Audio device changed trigger set to fire when your headphones disconnect. An If with Media is playing pauses the player with a Media control step, then Set default audio device moves sound to your speakers and Set volume turns it down.
Steps
- 1
Watch for the disconnect
Add the Audio device changed trigger, set it to fire when the device disconnects, and pick your headphones.
- 2
Pause what's playing
Add an If with the Media is playing condition, and inside it a Media control step set to Pause.
- 3
Move sound to the speakers
Add Set default audio device with your speakers so Windows doesn't guess.
- 4
Turn the volume down
Add Set volume on the master output, for example 25 %, because speakers are louder than headphones.
Tips
- Media control works with players that show up in Windows' media controls, such as Spotify, browsers and most video players.
- The Headset Disconnected template already switches devices and lowers the volume; add the Media control step to it.
Questions
- Does it work with wired 3.5 mm headphones?
- It works whenever Windows reports the headphones as an audio device that disconnects. Some motherboard jacks report this and some don't; USB and Bluetooth headsets always do.
- Can it resume when I plug them back in?
- Yes. Build the opposite routine with the trigger set to connected and a Media control step set to Play.