MPRIS is a D-Bus API by which multimedia applications can register themselves to handle when a user presses the "play/pause" buttons on keyboards/speakers/headphones.
In general, anything that's a media player registers via this API -- including music players and browsers.
Using the MPRIS API to determine "is there currently any media playing" sounds like a very solid solution -- definitely less guessing and false positive than using pulseaudio and peak detection.
MPRIS is a D-Bus API by which multimedia applications can register themselves to handle when a user presses the "play/pause" buttons on keyboards/speakers/headphones.
In general, anything that's a media player registers via this API -- including music players and browsers.
Using the MPRIS API to determine "is there currently any media playing" sounds like a very solid solution -- definitely less guessing and false positive than using pulseaudio and peak detection.