Forum Discussion
Background Audio Cool Trick
- 2 years ago
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!
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.
Wow thanks Dave I'll give it a go and let you know how I go ;-)