Javascript problem due to the update ?

Jan 23, 2020

Hi, 

I use a javascript code to do a "mute" tricks in my articulate courses.

After the update, this option doesn't work anymore. I can't mute the sound anymore...

It's because of the update ? 

Thx

21 Replies
Antonin Etienne

I'm not using jQuery, my question is about Javascript only, see yourself :  

I just wanted to know if this "mute" code is not working because of the update. Thx

var player = GetPlayer();

var value = player.GetVar("volumeSlider");

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

appState.onToggleVolume();
Katie Riggio

Hi, everyone. Thank you for your insight!

Since we don't support editing the published output, referenced system variables and ids for JavaScript that worked in earlier versions of Storyline might not work in later ones.

Could you share more about your needs and how you used the mute code? I'll see if I can help find another way!

Andreas Neuberg

The JS trick (un)muted all audio/video clips irrespective from their location on the timeline and layer in one shot. Especially useful with the chromeless player skin and multiple, distributed audio tracks. There is also a case open on this, see #02133078. Probably again time, to raise a feature request for a trigger "Mute all" ;-) Thx

Kristin Hatcher

No Javascript I've tried since the update will work, and working Javascript - the "mute all" others have referenced - is also no longer working. This is unfortunate. Yes, I could achieve the same thing using triggers, but A) I don't want the user to have to press a button on all 267 slides to hear or not hear audio, and B) With a large course it is too clunky to try and add that many triggers. 

If there is an existing feature request for Mute all, I'd like to be added to it. 

Travis Jackson

let btnNext = document.querySelector(".slide-control-button-next");
if (!btnNext.hasAttribute("onmouseup")) {
btnNext.setAttribute("onmouseup", "window.parent.ChildNav('Next');");
}
let btnPrev = document.querySelector(".slide-control-button-previous");
if (!btnPrev.hasAttribute("onmouseup")) {
btnPrev.setAttribute("onmouseup", "window.parent.ChildNav('Previous');");
}
let topicLinks = [...document.querySelectorAll(".item-collapsible li:nth-child(1) .cs-listitem")];
let slideLinks = document.querySelectorAll(".cs-listitem");
if (!slideLinks[0].hasAttribute("onmouseup")) {
let slideCount = 0;
let titlesArr = [];
[...slideLinks].forEach(slideLink => {
if (topicLinks.indexOf(slideLink) === -1) {
titlesArr.push(slideLink.getAttribute("title"));
slideLink.setAttribute("onmouseup", "window.parent.ChildNav(" + slideCount + ");");
slideCount++;
} else if (slideCount !== 0) {
slideLink.setAttribute("onmouseup", "window.parent.ChildNav(" + (slideCount + 1) + ");");
} else {
slideLink.setAttribute("onmouseup", "window.parent.ChildNav(" + slideCount + ");");
}
});
window.parent.SetTitlesArr(titlesArr);
window.parent.SetSlideCount(slideCount);
window.parent.CreateInstructWindow();
}

Jimmi Thøgersen
Jimmi Thøgersen

Just to explain that bit of code, it checks if there's a global DS variable (added in update 36). If it's there, it uses that to get to appState. If there's no DS, it assumes it's running in an older version of Storyline, and uses the require function instead (removed in update 36).

As mentioned in the other thread, that DS variable may disappear again in update 37 - or at any time after that. By definition, it's not future proof, since it uses internal undocumented features. But that's also the case for just calling onToggleVolume in the first place. :-)

Lauren Connelly

I wanted to update this discussion related to an issue reported where using jQuery selectors / jQuery's $.ajax() function in JavaScript trigger no longer works.

We're always on the lookout for new security concerns and ways to counteract them. Since jQuery has the potential to be exploited and Storyline no longer uses it, we removed jQuery from Storyline 360 and Storyline 3. If you're comfortable, you can still reference the jQuery library directly to write custom JavaScript. Here's how:

https://articulate.com/support/article/Storyline-How-to-Reference-the-jQuery-Library

However, keep in mind that some JavaScript triggers, like the one you mentioned, that worked before might not work in newer versions of Storyline.