Stop audio from playing when a container or popup is closed

I could use some help on this. I created a desktop player that houses several different music audio snippets. My goal is to have the audio stop playing once the player is closed. Presently, the audio keeps playing after the container is closed. Any ideas on how to acheive this? The floating audio player is the on desktop and tablet but not mobile. My common sense is telling me that this can be achieved with interactions? Link will be provided if requested.