Hi Jay, dunno if it's the best way but this is how i do it:
I have a global vars "setSFX" and "setMusic" that i set on or off.
For game sounds:
For every sound of the game i just use a condition:
So when the user clicks or touches the audio button i just change the value of that global var.
For Music:
I use the music file like a sound effect, not like music (don't remember exactly why). When i start playing the song, i tag it as "Music":
So when i want to pause it, i pause that tag:
*It doesn't appear in the image but i also change the value of global var "setMusic" to on/off when player clicks on disable/enable Music. Although we can pause/unpause music just using the tag, i also like to have the status recorded in a global var, so later i save it to cache to remember player choices when restarting the game
When i want it to resume i do the same with "resume tag".