Storyline 360 custom volume control

Today I was asked by my colleague at work to help her out with fixing problem with custom volume control. She was using StoryLine 2 solution from this page but on Storyline 360. Following is the script from the SL2 solution:

var player = GetPlayer();
var volumeCount = player.GetVar('volumeCount')

This worked on the courses exported from StoryLine 2 as the Audio object indeed has the setMasterVolume which is not true for StoryLine 360 courses. I’ve searched internet and failed to find anything about volume controls on SL360.
My colleague told me that SL has built in volume controls which work. I’ve enabled it and checked what has appeared in code (player-volume and control-volume-slider), then searched for it in output files. In the minified code I’ve found the currentVolume function which was something I hoped to get access to.

I’ve noticed that this method is wrapped with the define("helpers/appState"... so I’ve tried to retrieve it with require and succeeded

var appState = require("helpers/appState");

With this finding in hand it was now simple to modify the original code to work in SL360:

var player = GetPlayer();
var volumeCount = player.GetVar("volumeCount");
var appState = require("helpers/appState");

The SL2 example was using volumeCount property to make a division by 10 we can skip it and if we set up slider to be from start: 0 to end: 1 with step: 0.1 we can modify the script even further:

var player = GetPlayer();
var value = player.GetVar("volumeSlider");
var appState = require("helpers/appState");

Note: I have no prior knowledge of Storyline and I kind of hacked this solution, so if there is an “official” way to setup volume please let me know:)

I think better option for changing the volume will be to use the onVolumeChanged(value) callback method as it also updates the volumeToggle state.

If you want to have mute button functionality then use onToggleVolume() method.

var player = GetPlayer();
var value = player.GetVar("volumeSlider");
var appState = require("helpers/appState");

To toggle audio:

var appState = require("helpers/appState");

to test current state of the audio

var appState = require("helpers/appState");
if(appState.volumeToggle) {
// audio muted
} else {
// audio unmuted

4 thoughts on “Storyline 360 custom volume control

  1. Hi. I am trying to access the currentTime of the audio on a slide and display it. Since you accessed the volume. Is there a way to access the current time and duration in Storyline 360?

    • Hi,

      I haven’t tried this, there is a slim chance that it is somewhere in code accessible and could be exposed like this volume hack. Dont have much time now so wont be able to check it myself.


  2. Hello Lukacz, I am trying to use this script but as I change the position of the slider, instead to adjust the audio volume it mute my audio file!

    Any suggestion?

Leave a Reply

Your email address will not be published. Required fields are marked *