Background music - turn on the first page , and let it play automatically on all other pages

Hi! I’ve designed a website with background audio on each page, and made a little lottie animation toggle in the bottom right corner that triggers a simple html audio play/pause. It is a bit annoying to keep clicking that button on all pages, so I am trying to find a way to click it once on any of the pages, which will then play it automatically on all other pages, until user decides to mute it, then it is muted on all pages again.

I found a JS script, that is able to store something in the cookies, but it does the opposite, it keeps playing audio on all pages, and then I can stop it, but then when I reload the page I have to stop again. Plus it works only in Chrome both desktop and Android but unfortunately not in Safari or Firefox, I’ve published it on the About page and Contact page to test. And here is the script below.
Could anyone help me program this please?

<script>

function setCookie(c_name,value,exdays)
{
    var exdate=new Date();
    exdate.setDate(exdate.getDate() + exdays);
    var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
    document.cookie=c_name + "=" + c_value;
}

function getCookie(c_name)
{
    var i,x,y,ARRcookies=document.cookie.split(";");
    for (i=0;i<ARRcookies.length;i++)
    {
      x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
      y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
      x=x.replace(/^\s+|\s+$/g,"");
      if (x==c_name)
        {
        return unescape(y);
        }
      }
}

var song = document.getElementsByTagName('audio')[0];
var played = false;
var tillPlayed = getCookie('timePlayed');
function update()
{
    if(!played){
        if(tillPlayed){
        song.currentTime = tillPlayed;
        song.play();
        played = true;
        }
        else {
                song.play();
                played = true;
        }
    }

    else {
    setCookie('timePlayed', song.currentTime);
    }
}
setInterval(update,1000);
</script>

Here is my site Read-Only: LINK
(how to share your site Read-Only link)

I’ve found half way solution, still need help. Since my code is different now, I’ve started a new thread