Reputation: 1538
So i'm trying to test out using Howler.js to play an audio file. When I run this html file and press the button I get an error in console saying "An array of source files must be passed 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>
Upvotes: 7
Views: 4993
Reputation: 1
In your soundsData object, are you using src: ['sound1.mp3'] or something similar? Note that v2 has a breaking change where you have to rename urls to src
Upvotes: 0
Reputation: 458
Just for future solution hunters, src property is not working with all browsers. I used chrome canary and it worked.
Upvotes: 0
Reputation: 512
Should be
var pong = new Howl({
src: ['sound.mp3', 'sound.ogg']
});
Upvotes: 8