It may not be able to if the window manager doesn't tell the window it's hidden . Modern WMs that support composting and window thumbnails tend to not do that anymore. It does usually also have a nice side effect of also hiding if the user is idle or not to web pages/apps
In my specific case, i3 must tell it, since some sites know to stop playing sound when the window is hidden, but keep playing when I switch to a separate window that doesn't obscure the noisy one.