1

The Problem

I am creating a game using the canvas feature of HTML5, I am very new to Javascript though and I am stuck with how I will loop the audio. I have looked at tutorials but none of them have helped.

The Question

How can get the code below to allow the audio to repeat when finished?

//music
    var snd = new Audio("Menu.mp3");
    snd.play();
        document.getElementById('mute').addEventListener('click', function (evt) {
        if ( snd.muted ) {
            snd.muted = false
            evt.target.innerHTML = 'mute'
        }
        else {
            snd.muted = true
            evt.target.innerHTML = 'unmute'
        }
    })
RushFan2112
  • 325
  • 2
  • 15

0 Answers0