Javascript for audio mute/unmute that previously worked is no longer working

Jan 27, 2020

Hi All,

We have used this Javascript code in several HTML5 courses created in Storyline 360:

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

The Javascript (on a button click) worked to toggle the audio between playing and mute when the LMS version was uploaded to Scormcloud. I noticed today that the code no longer has any effect, so the audio just keeps playing. 

[UPDATE] It would seem that the Javascript isn't working when I publish the file, but does work when my colleague publishes??

Does anyone have a similar issue? Can anyone shed any light on this please?

Thanks in advance

13 Replies
Barney Barrett

We are experiencing this issue as well. We use the Javascript Helen gives above to provide an option for screenreader users to mute the audio.

The Javascript has stopped working for the members of our team who updated to the latest version of Storyline last week. Those who didn't apply that update find the code still works when they publish to both Review and to SCORM.

Grateful for a solution to this.

Thank you.

Helen Davies

Thanks both, yes this seems to be the problem - my colleague had not updated to the latest version of Storyline, hence his publish worked. I have now reverted to v3.35.21017.0 and the Javascript works when I publish. 

I now need to find alternative code for this functionality before I can update Storyline! Any help would be much appreciated.

Jimmi Thøgersen

Unfortunately, because the javascript for the player is now compiled differently, module ID's are no longer a path string ("helpers/appState"), but rather an integer (currently helpers/appState = 16 for the two update 36 versions so far, but that may change for each new Storyline version, when the included player code is recompiled).

Also the require function is no longer used in the same way (it's now __webpack_require__ but minified to a random letter, and it isn't a global function).

However, right now the player includes a global object - DS - which exposes many of the services of the player, including appState. That, of course, may also change again, without notice. But in update 36, and until something changes again:


... should do the same thing (both for modern and classic players) - although I haven't tested it.

And, of course, for both update 36 and earlier versions, something like this:

// Use the global DS object if it exists, otherwise try require:
var appState = window.DS ? DS.appState : require("helpers/appState");
Fiona OSullivan


I am not great with JavaScript, and this is my attempt at creating a custom player.

We needed the ability to jump back x seconds (I plan to make this a variable to adjust the time and update the button text quickly)  across multiple slides, and we wanted all the control in one place. The inbuilt player has buttons a bit scattered, and we can't add custom buttons.
The space in the player's middle is for the closed captions text, so it doesn't cover content on the slide.

I have managed to get all the code to keep its settings as we move from one slide to the next, except the mute button. If the user mutes, I want this to stay muted when we go to the next slide. Any help to solve this and tidy up my scripts would be greatly appreciated.

Feel free to use any of this code and set it up for yourselves as well :)


Learning Studio

Quick question: can i still use the code written downstairs?

I use an numeric entry input to set a number and let this run after that.

/*Get player to reference*/

var player = GetPlayer();

/*get LMS API*/

var lmsAPI = parent;

/*set score; the first number is the score*/

lmsAPI.SetScore(player.GetVar("14543GameScore"), 100, 0);

/*set status; possible values: "completed","incomplete", "failed", "passed"*/

if (player.GetVar("14543GameScore")>= player.GetVar("14543PassingPercentage"))

Math Notermans

Hi Hassan,

You might try this...

//Function for the LMS API
function findLMSAPI(win) {
if (win.hasOwnProperty("GetStudentID")) return win;
else if (win.parent == win) return null;
else return findLMSAPI(win.parent);

//get the LMS API
var lmsAPI = findLMSAPI(this);

set score; the first number is the score

lmsAPI.SetScore(player.GetVar("14543GameScore"), 100, 0);

set status;
possible values: "completed","incomplete", "failed", "passed"

if (player.GetVar("14543GameScore")>= player.GetVar("14543PassingPercentage"))

Kind regards,