Forum Discussion
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!
Hello, Everyone! ✨
I'm happy to share that we have released a new update for Storyline 360 (Build 3.79.30834.0).
In this update, we have an enhancement where:
- Background audio is now supported in the published video output.
As a first step, I recommend updating Storyline 360 to the latest version. Here's how:
If you have any questions, please let us know in this thread or privately in a support case.
Have a great day!
- WendyFarmerSuper Hero
Wow - thanks for sharing Emily - this is great.
One question...we create modules with content and then at the end add in a fun Module Challenge which is only maybe 10 slides and the client only wants the music on the challenge.
Do you know a way of just having the audio loop on those specific slides?
- DaveCoxCommunity Member
Hi Wendy,
Add this script to the head section of the story.html file:
<script>
function SetVolume(val)
{
var player = document.getElementById('myAudio');
console.log('Before: ' + player.volume);
player.volume = val / 100;
console.log('After: ' + player.volume);
}
function PauseAudio() {
var player = document.getElementById('myAudio');
player['pause']();
}
function PlayAudio() {
var player = document.getElementById('myAudio');
player['play']();
}
</script>Remove autoplay from the audio tag, so that it looks like this:
<audio id="myAudio" src="bensound-jazzyfrenchy.mp3" preload="auto" loop></audio>
This will cause the audio file to load, but not start. Now all you have to do is call PlayAudio(); from a javascript trigger in your storyline file. You can also call PauseAudio(); to stop the audio.
I Modified emily's file to add a volume control and play and pause buttons.
- WendyFarmerSuper Hero
Wow thanks Dave I'll give it a go and let you know how I go ;-)
- BrennaJueCommunity Member
Wendy, I'm looking for the same feature. Did you ever find out how to do this?
- TeriSlaterCommunity Member
Thanks SO much Emily! Worked like a charm!
- TiaraCCTiaraGutCommunity Member
Hello, I need to know if possible, enter the code in the file " INDEX_LMS "?
Hi Tiara,
Emily is out this week - so I can't speak to the specifics of her set up - are you looking to add it there for use within your LMS? It's worth giving it a try if the story.html file isn't working for you - and you could always upload it to SCORM Cloud if you're not ready to post within your LMS.
- TiaraCCTiaraGutCommunity Member
Hi Ashley
But where in the code " INDEX.LMS " could go audio code ?
- EmilyBurnettCommunity Member
Hi Tiara,
This method should work with LMS in the same way. You should not need to add anything to the index.lms. Just add it to the story.html file. I just ran mine through SCORM Cloud to check, and it worked the same.
- AndreaSquires-aCommunity Member
Hi Emily,
Thank you for the wonderful audio trick, it's works like a charm when I'm publishing to web. But I need to publish to an LMS and mine needs the file to be zipped. I tried publishing as SCORM, adding the code, and then zipping and uploading. LMS wouldn't accept the file. Any ideas what's happening? Thank you.
- WendyFarmerSuper Hero
Hi Emily welcome back - can you check out my post above and is there an answer?
- EmilyBurnettCommunity Member
Hey Wendy,
I am not sure of a way to have this loop only on selected slides. This method will loop it through the entire course. I am only just beginning to dive into learning these kind of tricks, so hopefully someone else in the community may know of a way to do this.
If I do stumble across a way to achieve this, i will share an update here.
Thanks for popping in to share your solution as well Scott :)
- AmyEspositoCommunity Member
anyone know if there is a way to adjust the volume on background audio
- ANDREWGOLDSBYCommunity Member
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! https://community.articulate.com/discussions/articulate-storyline/background-music-demo?page=7