Forum Discussion
Javascript for audio mute/unmute that previously worked is no longer working
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();
Thanks for this!