Forum Discussion

TwoFirstDesigns's avatar
TwoFirstDesigns
Community Member
3 years ago

Javascript for audio mute/unmute

Hi all! 

Does anyone have java for 2022 that works for toggling mute using a custom menu? Seems like the most recent post suggestions no longer work. 

Thanks!

  • For anyone who needs it! Below works as of 5/19/22. :) 

     

    var appState = window.DS ? DS.appState : require("helpers/appState");
    appState.onToggleVolume();

  • This is great. The only challenge is when the course resets the sound is still off... but when my course starts my variable thinks the sound is on so my sound indicator doesn't match what's happening... 

    Any ideas... 

    My thought is to execute a trigger when user clicks the replay button that switches the volume on if it's off and does nothing if it's on... but I don't know how to write that.. 

    has anyone solved this?