I have a mobile website that plays a background song. When I pressed the home button on my phone and leave the browser the song keeps playing until I go back on the browser and close the tab. this is the code for the song I have.
<audio preload="auto" src="song.mp3" loop="true" autobuffer id="myAudio">
Unsupported in Firefox
</audio>
How would I make it so the song only plays when I am viewing the page? Browser is Google Chrome and device is Android.