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

Hi All,

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

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

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
Helen

8 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.
Thanks

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:

DS.appState.onToggleVolume();

... 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");
appState.onToggleVolume();