Forum Discussion
Muting Audio when course starts
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?
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.
I attached the sample Storyline project for your reference. Let me know if that works for you!
- ShawnaGigacz-47Community Member
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.
I'm happy to help, Shawna! Glad to hear the suggested solution is useful for your other projects! I hope our JavaScript experts in the community can chime in with their recommendations.
Enjoy the rest of your day!
- ShawnaGigacz-47Community Member
Any JS experts out there?
- Jürgen_Schoene_Community Member
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
- CarolDawsonCommunity Member
Thank you so much! This is a perfect solution to meet my need.