kerry
kerry

Reputation: 11

error decoding audio file Howler not working

I tried to use Howler in a js file. Just to see how it worked. This is the code:-

 let isPlaying = false;
  let songE = document.querySelector(".song");
  songE.addEventListener("click", function () {
    let sound = new Howl({
      src: ["./sounds/crash.mp3"],
      volume: 0.5,
      onend: function () {
        isPlaying = false;
        alert("Finished");
      },
      onloaderror: function () {
        console.log("Error loading sound", arguments);
      },
      onplayerror: function () {
        alert("Error playing sound");
      },
    });
    sound.play();
    isPlaying = true;
  });

I kept on getting this error:- the error I was getting

The files didn't have any problem. It worked in the simpler new Audio('song.mp3) way.

I tried to change the file format to OGG and WAV it didn't change anything. Hoping to get some help from someone.

Upvotes: 1

Views: 23

Answers (0)

Related Questions