I honestly don’t know if this is possible within WordPress. Can I have a song begin playing on page load and then as you navigate the site by visiting other pages, the song continues to play without stopping and then doesn’t loop after the first play? I don’t want the song to re-start on every page load because having a song playing in the background of a website is already an iffy topic. I just want to set the mood for the website. And the song, “I Wanna Be Your Dog” by Émilie Simon, is rather unobtrusive.
You can’t. Web is stateless, so as you navigate to new page new ‘state’ is created. To do this properly, your linked content needs to load via AJAX so that the current state can be preserved and music keeps playing. To stop looping all depends what sort of player you’re using.
I would personally never start any sound on a website for any reason without the user telling me to start it. Also, I’m fairly certain every mobile browser will not load any auto-play video or audio. I know you probably know this since you mentioned it, but I just wanted to reiterate.
As for WordPress and AJAX, you’re not looking for an AJAX music player, but a way to make all of WordPress “AJAXified”. I’m sure it’s possible, but it won’t be easy. You might want to find themes that do it for you if they exist.
Once that’s done, JS is actually calling the PHP functions without a full page postback and you could technically have your music continue to play while PHP is building your new page.