Storyline 360 In-Story Volume Control Scripts

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
Lukasz Grela

Hi,

try this:

var player = GetPlayer();
var volumeCount = player.GetVar('volumeCount')
//Audio.setMasterVolume(volumeCount);//there is no Audio in SL360 as it was in SL2
var audio = document.getElementById('bgSong');
audio.volume = volumeCount;

can you tell me how you put reference (bgSong) to your audio in slide?

Donna Westwood

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! :)