Muting Audio when course starts

Feb 10, 2023

I am using the code:

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

on a custom mute/unmute button and it work great, but I want the audio file to automatically be muted when the course first starts. The user would have to click to turn the mute button off to listen to the audio. Is this something that has to be done in js?

6 Replies
Eric Santos

Hi Shawna,

I'm happy to chime in! You might find that the solution below, using triggers and a custom variable may work. The recent Conditional Trigger Enhancements in Storyline 360 allowed for a more streamlined approach. Please check this annotated screenshot of the triggers.

Triggers panel

I attached the sample Storyline project for your reference. Let me know if that works for you!

Shawna Gigs

Hi Eric,

Thank you for your suggestion. This will come in handy for some other project I am working on, however for this one I do need to mute the audio, not stop the audio and then start the audio from the beginning again. 

I'm hopeful there is an easy piece of javascript that I can add that will mute the audio on load. 

Jürgen Schoenemeyer

this are the possible command to change the audio level

DS.appState.onToggleVolume();
DS.appState.currentVolume() // get sound volume [0 ... 1]
DS.appState.setVolume(value) // set sound volume value: [0 ... 1]
DS.appState.lastVolume // get value: [0 ... 1]

you can mute audio with

DS.appState.setVolume(0)

and set to the default player audio level with

DS.appState.setVolume(0.75) 

you don't need ... require("...") - this was for earlier storyline versions