Keep Safari from hijacking the media buttons from controlling iTunes I'm on a Mac with no TouchBar (so I don't think this answer will help) running 10.13. I had YouTube open and my media buttons weren't useful for stopping iTunes so that I could start a video. Is there a setting that will stop Safari from being able to use those buttons? 

I would prefer not having to install 3rd party software to do this. 

This is still going on in macOS 10.14
This was driving me crazy, so I wrote a little menu bar app to make the media keys only affect iTunes:

http://stuntsoftware.com/reflex/