Forum Discussion
Javascript to MUTE audio?
Thank you. How did you set up your triggers?
Apologies for the delay in responding. Nicole has linked to an earlier part of this thread, but if you still aren't clear here is what I did.
I created a basic audio button with an OFF state (selected). I placed it on the Master Slide because I wanted it to be applicable/accessible on every slide.
I attached a trigger to it to Execute Javascript - simply copied and pasted the code above into the javascript panel that opens up. This script works as a switch. Anytime it runs it either turns on or off the audio.
I also created a variable called MUTE_AUDIO just to monitor the state of the button, whether it was selected or normal. And I set it to TOGGLE, like a switch. This is basically giving the user a visual clue as to what is happening (if they can't hear it already :) ).
You can see that the only real use of the MUTE_AUDIO variable is to have Storyline check whether the Audio Button is switched on or off as each slide begins so it can change the state of the Audio Button accordingly. You don't want the button resetting to Normal if the user had clicked the audio to be off in an earlier slide.
I hope that wasn't overkill on the explanation. If you have any further queries do let me know.
Once again, my thanks to Lizzie Angell for the code. It really helped me out on a major build.
- ShawnaGigacz-472 years agoCommunity Member
Hey there! I followed you explanation and it works great. When I mute the audio and the audio button show it’s muted and proceed to the next slide, the audio button is still muted. However, when I go backwards, it changes back to being unmuted. Do you know why this would happen?
- NunoCardoso2 years agoCommunity Member
Could it be that you have the slide set to “reset to initial state”?