Step 12. Add music

Now we add some background music. Insert the following code right at the top:
 const MUSICFILE = '/uploads/starter/SuspenseStrings.mp3';
 AB.backgroundMusic ( MUSICFILE );


Note on music autoplay: On some browsers, audio will not play automatically, but only in response to user interaction. So the code gives the user play and pause buttons. See notes on Audio autoplay on web pages,


Use your own music

  1. Get a downloadable file of some music you like.
  2. One site with free music is freemp3cloud.com. There are many others.
  3. When you find music you like, download the music file to your computer.
  4. Then upload the music file to Ancient Brain.
  5. Edit the code to play your music file.
Tweet this step: