By default, this script will pause instead of mute. To make it to mute instead of pause, change the muteInsteadOfPause variable in the script from false to true .

This script will only pause/mute if the current tab has been fully loaded before switching to other tab. IOTW, it won't pause/mute if the current tab is still loading when switching to other tab.