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, http://bit.ly/1sy5dkV  and the output folder is attached.

Have fun!

256 Replies
OWEN HOLT

I think I misunderstood your request. I don't see JavaScript being executed at all in your file. I'm not the expert at manually adding the code outlined in this thread (and I'm not a fan of it either... lol) so I couldn't really say what is going wrong in your post publishing production. If you want to try the JavaScript method, let me know. If you are using it and I'm just not seeing it, point me to where it is located in your file.

Irina Chekhova

Hi everyone!

I am making an interactive video manual, where speaker says some words, what the learner should do, some special extra things etc., then video pauses and user should do what he/she was told to. I need a background music to work even when the video is stopped. And I can do it, BUT I need the background music to stop somehow when I need it to stop and I have no idea, how to do it.

Here are some of my thoughts:

1.I have created a variable 'VideoFinished' in SL, that changes its value once user completed the necessary task. It's initial value is 'no', once user double clicks the first hotspot it turns to 'yes'

2. Added trigger "Execute Javascript when timeline starts on the slide"

3. JS is supposed to take the variable 'VideoFinished' from the course and use it as a condition whether to play music or not.

If I do not use any conditions on JS, audio is playing fine, it is looped, volume is adjusted.

However once I add a 'while' to JS, no audio is played at all.

Can someone please let me know, what am I doing wrong? Here is JS, var video - is a variable in JS that should be equal to the 'VideoFinished' of SL:

var player=GetPlayer();
var video=player.GetVar('VideoFinished');

while (video=no) {
var audio = new Audio()
audio.src = 'story_content/5kxW8RMEV8D_44100_48_0.mp3'
audio.play ()
audio.loop = true
audio.volume = 0.5
}