It's time to take our game to the next level by adding both sound effects and music. Here, we'll cover everything from finding audio, importing audio cleanly, and playing audio when certain game actions take place. We'll also be using the npm library
howler to fix a native JS
Audio() object bug.
Step by step, the process looks like this:
Move files to audio folder within project
Add file loader for mp3s
Create separate file for loading audio
Add fire-flower shoot audio
Import / export all files using howler with correct volumes
Place in correct positions
Autoplay and loop background music
Stop background music on course complete
I got this error when adding the fire flower sound effect.
canvas.js:52 Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD