Storyline 360 In-Story Volume Control Scripts
Jul 13, 2017
Skip to the bottom for the bolded question for TLDR. So I've added continuous, looping background music to my presentation, and added a volume slider to adjust that. This is the script I use to begin the music:
var player = GetPlayer();
this.Location= player.GetVar("location");
var audio = document.getElementById('bgSong');
audio.src=Location + "Corporate Background.mp3";
audio.load();
audio.play();
The slider was connected to a variable called "volumeCount" (from http://www.swiftelearningservices.com/how-to-create-custom-volume-controls-in-articulate-storyline-2/) - and it does not work at all. So instead, I used the regular volume adjustment to match the corresponding volume of the background music to the position of the slider (1-10), and it worked brilliantly for the background music. The script (ex/ for 1) looks like this:
var audio = document.getElementById('bgSong');
audio.volume = 0.01;
Unfortunately, this only changes the background music. I tried to incorporate this with the script used from the link above, which is:
var player = GetPlayer();
var volumeCount = player.GetVar('volumeCount')
Audio.setMasterVolume(volumeCount);
and I could not get it to work. I want to connect this slider, in the exact same way, to the master volume of the in-presentation volume (the narration). How do I make this work?!?! I know little to nothing about java.
8 Replies
Hi,
try this:
can you tell me how you put reference (bgSong) to your audio in slide?
I have found a solution, and described it here on my blog but for those who dont want to click on the link below is the script:
Lukasz, Fabulous idea!!
I am not great at coding - but I am desperately trying to get your code to work on a toggle button - so click one object audio mutes, click another object it resumes - any hints??
Thanks so much!!
Hi Donna,
on the click button action use this code:
to find out in what audio state it is:
test the
appState.volumeToggle
property.Legend... testing now - will come back to with any issues :)
Works perfectly locally - hoorah!! now for the acid test.... externally hosted.....
Lukacz, I salute you - you have literally saved my life... I have a project due for delivery tomorrow in SL3, I was using the old method from SL2 - and at the 11th hour realised it was no longer functioning!! Without your fix I would have had to rebuild the entire project from the ground up in SL2 just so one button would work! I owe you a beer! :)
Hi,
I have tried to implement your code Lukacz, but it doesnt work.
As I move the slider the audio gets muted. Any idea on how to mix this? Have I missed something?
Not very good with code.
Thanks!
This discussion is closed. You can start a new discussion or contact Articulate Support.