Background Audio Cool Trick

Hi All,

Just wanted to share a way to add audio across all slides in Storyline 2 There are a few posts on here about this, and I found this method to be super simple.

**Please note that this is just a cool trick, and not a built in feature of Storyline 2.

Publish your course, open the story.html file with Notepad, scroll to the bottom and add this code

<audio src="YOURAUDIOHERE.mp3" preload="auto" autoplay loop></audio>  with a space before the </body> and place your audio file into the published output folder and there you go. That is it.

Here is an example,  and the output folder is attached.

Have fun!

258 Replies
Dawn DeVillers

I am in desprate need to have music in the background throughout the course. I have tried your files and code and I can not get it to work. I am using storyline 360. someone please tell me what I am doing wrong. 

Ideally I would love to use javascript to control what slides play what music. 



Crystal Horn

Hi there, Dawn. You mentioned wanting to control which slides play which music. Do you need a single audio file to play throughout the entire course, or can you use different audio files for each slide?

If they are different on every slide, have a look at adding audio to your Storyline 360 slides.


I spent a good while trying to do the same thing. This will take you about an hour if you work through it, which is relatively much simpler. Not sure if this is still a problem. I've been searching all day for solutions and thought I'd share the one I finally came up with. Good luck!

Deirdre Sherman


Can you explain what "BEFORE <body> and <html>" means? The original post indicated the line of code be added after you "...scroll to the bottom and add this code with a space before the </body>" - I see one "body" reference at the bottom of my file. I take it we mean pasting the code before the reference "body" with a space between </body> and the end of the code.

Is this correct?

Dave Cox

Hi Jill

In HTML, all of the code for the "body" of the page must be placed in between the <body> and </body> html tags. If you are instructed to insert code Before the <body> tag, then you should insert your code before this this tag on the code page. It doesn,t necesarily matter where before, just as long as does come before that tag.



Deirdre Sherman

I was finally able to get it to work by inserting the code below into both the story.html AND the story_html5.html files. The problem now is that the background music is drowning out the VO. I used this code: 

<iframe src="YOURAUDIOHERE.mp3" allow="autoplay" id="audio" style="display:none"></iframe>

Does anyone know of a way to set the volume of the background music? 

Todd Haynes

I don't use this code because I find it to be technically buggy and the process is time consuming (hand edit code each time you publish). Instead, I've build projects with only 1 slide and a LOT of layers. Just put the background audio in your slide or a layer... The viewer has no idea the presentation is composed this way. Yes, managing that many layers has it's own issues - but when you click Publish, it works on ALL browsers and mobile devices and has no issues with LMS & SCORM integration.