Forum Discussion
background music in Storyline
Hi everybody,
Is there any way to insert background music like in Presenter in Storyline?
Thank you
Hi everyone!
I have some great news to share. We just released another update for Storyline 360. In Update 74, we've included important fixes and new features.
One of the new features we've included is:
- Create immersive experiences with continuous background audio that sets the tone and keeps learners engaged.
Launch the Articulate 360 desktop app on your computer to take advantage of this update, and click the Update button next to Storyline 360. You'll find our step-by-step instructions here.
Please let me know if you have questions!
Hi Hima! Hopefully Kenny is still subscribed to this thread, but if not, please reach out directly via the 'Contact Me' option on the user profile.
- AndrewProbert1Community Member
If anyone still needs help with adding background music to play throughout a course, this works for me.
- After publishing your course, open the html5 file in a text editor
- In the code look for the end of the body section. Look for the closing body tag </body>
- Just before this put in this audio code
<audio autoplay loop>
<source src="yourmusicfile.mp3" type="audio/mpeg">
</audio>
- Save it and then you should be good to go
- HimaJastiCommunity Member
Does the background music pause or mute when you use the player controls?
- AndrewProbert1Community Member
I don’t think it will, but I’m not using the volume control or pause in my project so I’m not sure.
Thanks Andrew for sharing here.
Hi Andrew,
Just an FYI that responding via email includes your signature here, and you're welcome to edit the post to remove that information if you wish.
- AndrewProbert1Community Member
Thanks Ashley!
- AndrewProbert1Community Member
It's not a perfect solution, but it works for the right course. I basically turn the player volume control button into a play/pause button for the background music. Then if you want to control the volume for the course narration or sound effects you could build another volume control button on the slides themselves. Or users can just control their computer volume.
So here's the best I've come up with:
1. Open the story_html5.html file
2. In the audio tag give it an "id". You can give it whatever id name you want(I just chose "bg-music"). So the audio tag would look something like this:
<audio autoplay loop id="bg-music">
<source src="yourmusicfile.mp3" type="audio/mpeg">
</audio>
3. Find the volume control. The code looks like this:
<div id="control-volume" class="controlbar-button compact"><a class="icon volume half"></a></div>
Notice it already has an id of "control-volume"
4. Before the end of the <script> section, look for the </script> tag. Add in this bit of code:
var volume = document.getElementById('control-volume');
volume.onclick = function toggleAudio() {
var theAudio = document.getElementById('bg-music');
if (theAudio.paused) {
theAudio.play();
}
else {
theAudio.pause();
}
}Basically what this is does is create a function that turns the volume control button into a play/pause button.
5. You also need to open the player.css file to change some styling to remove the volume slider. You may not have to actually change all of these, but just to be safe I did. You can play around with it a little if you want.
- Comment out or delete:
.controlbar-button.compact.volume-open
and
.volume-handle
- Change display to "none" for:
.volume-slider
and
.volume-open .volume-touchpad
and
.volume-open .volume-slider
Its not as much of a hassle as it may look. Let me know if there any problems or if someone has a better solution.
- HimaJastiCommunity Member
Great stuff Andrew. Not the exact solution for my case but I am sure it's going to help me a lot in future.
Thanks for popping back in to share with the curious minds Andrew :)
- KevinThornSuper Hero
Good stuff Andrew!
I'll play around with this approach as soon as I can, but have a couple questions:
What did you do for the Volume button icon?
The volume button may function as a play/pause button yet also confuse visual behaviors when the expected icon is for volume is a speaker, whereas the icons for play/pause are the standard triangle for play and double-vertical bars for pause.
Have you found anything in the .css to point to or assign a different icon to that control?
- AndrewProbert1Community Member
I left the volume icon as is. The effect of playing/pausing the background music vs muting it, is pretty much indistinguishable to the user. A play/pause icon may be more confusing for the user, because they may associate that with playing/pausing the course.
- KevinThornSuper Hero
Good point. So essentially your method is a volume On/Off button for background music. Yet, by doing this negates any further use of that button for course volume such as audio narration?
- AndrewProbert1Community Member
Yeah, unfortunately its not the greatest solution since it does negate the volume button for the rest of the course. As I work around I might have a narration sound mute button trigger on each slide. The volume level slider I don't really miss. I don't see a situation where the user would need to adjust the volume level(other than mute or unmute) using player controls. I think most users adjust volume levels using the computer's volume control.
- KevinThornSuper Hero
I want to go test and play with this code now, but I can't just yet!
It's got me thinking about your JS code. Wonder if you could leave the default Player volume alone and apply that code to a button on a Master slide (global) that would still control the background music.
- KristyCathroCommunity Member
Hi - I desperately need to add background music to a project, but have no idea about code and I'm struggling with understanding some terminology.
I am sure I can cut & paste the code as directed, but what I don't understand is the instruction "Where "1.wav" is the name of the audio file you want to use. The file must be in the root
directory with story.html"How do I ensure that the file is in the root directory?
I really need "dummies" instructions on the entire process or screenshots PLEASE.
Thanks