Howler.js error: 'array of source files must be uploaded with any new Howl'

So I'm trying to test using Howler.js to play an audio file. When I run this html file and click the button, I get an error in the console: "Array of source files should be uploaded with any new Howl".

HTML:

<!DOCTYPE html>
<html>
<head>
<title>Play Sound</title>
<script src='./howler.js/dist/howler.js'></script>
</head>
<body>
<button id="btn">Play</button>

<script>
  var pong = new Howl({urls: ['sound.mp3', 'sound.ogg']});
  document.getElementById('btn').onclick=function(){pong.play();}
</script>
</body>
</html>

      

+3


source to share


2 answers


Should be



var pong = new Howl({
     src: ['sound.mp3', 'sound.ogg']
});

      

+3


source


Just for future solution hunters, the src property does not work with all browsers. I used chrome canary and it worked.



0


source







All Articles