I'm almost positive you can get this exact feature if you just use Chrome. Google added a power saving feature to Chrome a while back (Chrome 57 I think) called "Optimize background video playback". It Disables video tracks when the video is played in the background (but continues to play the audio) to optimize performance, and its in Chrome for Mac, Windows, Linux, Chrome OS, Android. It's turned on by default so you don't have to do anything to enable it.
I'm almost positive you can get this exact feature if you just use Chrome. Google added a power saving feature to Chrome a while back (Chrome 57 I think) called "Optimize background video playback". It Disables video tracks when the video is played in the background (but continues to play the audio) to optimize performance, and its in Chrome for Mac, Windows, Linux, Chrome OS, Android. It's turned on by default so you don't have to do anything to enable it.