While browsing on Safari and listening to iTunes I come across a video and then press the "play" button on the keyboard (to stop the music while I watch the video) it starts/stops the video instead of the music (I have no control over the music).

How can I quickly play/pause my music without affecting the video?

  • As I have just found and reported here if the other app is VLC, then now it can automatically pause iTunes and Spotify when playing media, and it can even resume them afterwards! I don't use this option, but from your question I thought you may like it (VLC can also play Youtube videos and playlists). Refer to the linked post for the details about how to enable the option. Mar 19, 2019 at 10:33

4 Answers 4


If you're not averse to downloading some of the most useful software I've ever installed you can set the play/pause button (on my keyboard fn+F8) to always control iTunes using Karabiner-Elements.

Just add something like the following rule to ~/.config/karabiner/karabiner.json

   "description": "Play/pause button should only control iTunes.",
   "manipulators": [  
         "from": {  
            "key_code": "f8",
            "modifiers": {  
               "mandatory": [  
         "to": [  
               "shell_command": "osascript -e 'tell application \"iTunes\" to playpause'"
         "type": "basic"

You may remove the "modifiers" part if you normally press F8 without pressing fn to play/pause iTunes.

Then in Karabiner-Elements you'd add your new rule as a complex modification:

enter image description here

  • 2
    Getting rid of the modifiers part would look like "from": { "key_code": "f8" }, Oct 3, 2017 at 23:45

Base on the @minseong 's answer, I wrote karabiner complex modification rule.

You can find "Media key only control iTunes" group in the https://pqrs.org/osx/karabiner/complex_modifications/

Just import and enable it. (Below capture only shows f8 rules, but soon f7 and f9 rules will be added.)

karabiner complex modification rule repository capture

For more detailed solution, check this link


  • Needs the obvious update due to the release of Music.app in place of iTunes.app; I got it to work by doing the following: just go to ~/.config/karabiner/assets, find the most recently modified json after importing the above, make the above name change, and reload the modification in the Karabiner UI.
    – ijoseph
    Jun 14, 2023 at 19:07

You could just add the iTunes or (since High Sierra) Now Playing widgets to notifications centre:

enter image description here

On a MacBook at least this becomes even easier because the notification centre is just a two-finger swipe away.

In fact, there's even a keyboard shortcut you can set to open up the notifications centre:

enter image description here

  • 1
    nice suggestion! do you find this to be easier than app switcher + key board shortcut?
    – JBallin
    Oct 3, 2017 at 23:34
  • I don't really use iTunes that much to be completely honest. If I was having the same problem as you I'd fix it with Karabiner-Elements, which has become my go-to for these kinds of problems. But yes, this is clearly easier than app switcher + keyboard, because <kbd>⌘</kbd><kbd>tab</kbd> won't always go straight to iTunes and you can keep "focus" on whatever app you're currently using instead of having to switch back and forth between different apps.
    – minseong
    Dec 12, 2017 at 7:47
  • I'm used to navigating my apps using cmd-tab so and prefer to keep my hands on the keyboard when possible (vs. mouse). I still think this will take more time as I would have to mouse over to the pause button, right? Couldn't find another way to pause. Also I typically keep the Notification Center open to notifications vs. "today"
    – JBallin
    Dec 13, 2017 at 22:31
  1. cmd+tab (switch to iTunes)
  2. space (pause or play music)
  3. cmd+tab (switch back to App)

Mac Media Key Forwarder allows you to set the media keys to only control either Spotify or iTunes (instead of whichever app you happen to be using).

You must log in to answer this question.

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