There are four pages to the story/game. The first page plays one track, and the following page plays another, which then continues without interruption as the player moves back and forth through the story. The code works, as in the different music tracks play on page 1 and 2-4, but obviously the first track isn’t stopping - so it just overlaps the second track and I end up with blended loops!
This is the code I have used on both pages
var audio = document.createElement('audio'); audio.src = 'https://www.linktomusicfile.com'; audio.loop = true; audio.play();
I’m sure there’s probably a simple solution to make sure that the first track plays only the first page (and overrides the second track, should the user decide to restart or skip all the way back), but damned if i can find it.
thanks so much to anyone who can help! Ideally I’d like to solve this in JS rather than learning a whole new system (I’ve seen Harlowe Audio Lib recommended to a few folks on my endless trawls through google trying to solve this) but if thats what I gotta do I’ll do it!