It looks like you're new here. If you want to get involved, click one of these buttons!
{ <audio autoplay loop id="longlost" > <source src="https://dl.dropboxusercontent.com/u/56322638/twine/long_lost_8bit.mp3" type="audio/mpeg"> </audio> <button type ="button" class="button" id="mute"> <img id="muteimg" src="https://dl.dropboxusercontent.com/u/56322638/twine/mymutebuttonwh.png" alt="mute" onClick="toggleMute(this);"> </button> }
function toggleMute (img) { var image = document.getElementById('muteimg'); var audio = document.getElementById('nowplaying'); if (img.src.match ("mymutebuttonwh")) { image.src = "https://dl.dropboxusercontent.com/u/56322638/twine/myunmutebuttonwh.png"; audio.muted = true; }else { image.src = "https://dl.dropboxusercontent.com/u/56322638/twine/mymutebuttonwh.png"; audio.muted = false; } }
Comments
One potential problem with using a header tagged passage to create your audio element is that because the header is actually part of the current passage being shown it is destroyed and re-created each time the Reader navigates between passages. This in turn will cause the music to stop and restart for each navigation.
The Fading out/Stopping Looped Music in Passage(s) thread covers a method that uses a hidden audio element and Javascript to play sound instead, be sure to read the entire thread as there are amendments/suggestions to the solution at the end of it.
You would still need to include the mute/unmute button in a header.
here's the code if you have any suggestions to make it better:
In a passage with a header tag:
In the Java Script: