If you want to do this in JS, then there are lots of existing libraries for it - just google JavaScript Jukebox.
The whole reference for creating your own is here: https://www.w3schools.com/tags/ref_av_dom.asp
But you may want to look at Taonis’ answer to your previous question - Objects / Button across Scenes
You could create a jukebox as a symbol with the audio tracks on timelines and use this method to add it to all pages for continuous audio.