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!
- RyanCarlsonCommunity Member
This is a great solution, but is there anyway to add something that would allow he pause/play button to actually pause the background music too? OTherwise, it works great even when publishing for xAPI.
- DarinFennellCommunity Member
Emily,
This looks like a great idea that is simple to execute. Unfortunately, I am not able to get it to work for me. Any help would be greatly appreciated. BTW, I am using Storyline 3 on a Windows 10 computer.
- NandhakumarS-f5Community Member
Hi All,
I'm adding background music to my course. The BGM should play throughout my course continuously. So, I have used the javascript as provided in this discussion. It works well. But if I move to the next slide by clicking the next button, the BGM is starting over from the beginning. It would not start from the beginning. Need a solution to that. Can anyone help me out of this?
One more thing the next button that I used is a player default.
- JaneJordan1Community Member
Hi where do you put the audio file?
- OwenHoltSuper Hero
The audio file can be anywhere on the internet or a server. I add mine to the course resources so it gets published with the rest of the project and stay with them. Once I know the published path, I can use that to point to the file, update my code with the path, and republish.
Regarding publishing as a movie, I doubt this would work as JavaScript is a programming language used on the web. For music to play across a published StoryLine movie, you would need to add the "soundtrack" using any video editing software.
- JaneJordan1Community Member
Will this work if I am exporting to video?
- AldenMichelsCommunity Member
Following this advice ruined my project. Be sure to save a copy before you try any of this. Instructions are poor and have big risks.
- OwenHoltSuper Hero
Following which advice? Editing the html code or integrating JavaScript?
I've never had the JS code ruin a project, however, I totally agree with the "save a back-up".
I always have (at least) 2 versions of a file at any given time. One that is an archive of the last working version (updated as things work) and a working version were I make changes.
- RenGomezStaff
Hi Alden,
So sorry to hear your file is coming across corruption issues! I've opened a support case on your behalf to connect you with one of our support engineers to see if we help in any way.
To clarify, your .story file and your published output files are two separate items, and although we don't support modifying published output files, it shouldn't have affected your .story file in any way. It's most likely something else that's causing the corruption.
Look out for an email from support@articulate.com shortly!
- TravisJerovetz-Community Member
Hello, i have been trying to use this method as well but i cant get it to auto play. Here is a snip of the code I added:
</script>
<link rel="stylesheet" href="html5/data/css/output.min.css" data-noprefix />
</body>
<script src="html5/lib/scripts/ds-bootstrap.min.js"></script><audio src="perspectives.mp3" preload="auto" autoplay loop></audio>
</html>
I aslo have the mp3 added on the same level as the story.html file.
Any suggestions?
Thank you!
- DaveCoxCommunity Member
Hi Travis,
Why are you adding these lines to your html file?
<link rel="stylesheet" href="html5/data/css/output.min.css" data-noprefix />
</body>
<script src="html5/lib/scripts/ds-bootstrap.min.js"></script>I suspect you don't have those paths, or those files in your project, which will cause a file not found error, or a path not found error. The script line loads the bootstrap library, which isn't needed in Storyline. The Link statement probably loads the accompanying css for that library. If you were going to use this library, you would need to load these statement before the <body> tag to work correctly.
You also have the audio section inserted after the closing body tag, </body>. You may need to move that resource into the body section of the code. (Before the </body> tag.)
- TravisJerovetz-Community Member
Thank you for your quick reply, Dave.
The only code i actually added was the audio file (<audio src="perspectives.mp3" preload="auto" autoplay loop></audio>). The rest of that snip was just showing placement. I tried moving that audio file to the body section but that hasn't corrected the issue.
I assume that i can add that mp3 file within the course contents on the same level as the story.html file, but for whatever reason, the audio file still doesn't play.
- RyanCarlsonCommunity Member
Hi, Travis, hope that someone didn't already cover this in the thread as I haven't been able to read the entire thing. If you're fairly certain you're following the instructions, it could also be that your browser is actually launching the "story_html5.html" file (as opposed to the story.html). Are you editing both of those files that are contained in the publishing storyline output?