Hi Cheryl!
“Mute~UnMute” Demo: MuteUnMute_Demo_JHSv1.hype.zip (351.9 KB)
A few changes - mainly we no longer need to have a “firstPlay” variable as the audio now starts when the Scene opens, so the parts of the code that relate to that aspect have been removed.
The audioInit() function that runs when the Scene opens (“On Scene Load” handler) now is
window.myAudio = hypeDocument.getElementById("myAudio1");
myAudio.play();
The MuteUnMute() function does exactly that - and is the same basic code as the previous “playMute” function - but as mentioned above but no longer tests if the button has been clicked before.
Additionally, when leaving “Scene 1” we have a closeScene() function that is triggered by the “On Scene Unload” handler that stops the audio. Returning to “Scene 1” starts the audio playing again from the beginning.