Forum Discussion

JannisGoossens's avatar
JannisGoossens
Community Member
2 years ago

Background Music Java Script Controls?

Hi everyone,

the new Background-Music feature really keeps a lot of workarounds off our backs - that's great.

However, as settings are very limited at the moment, I am wondering whether the Background-Music and -Playlist can be controlled via JavaScript Triggers - e.g. manually setting the volume or mute only the Background Music (most important), start/stop the playlist, selecting a certain track from the playlist, etc...

Any Heroes around who can help me out?

  • Following - The ability to allow users to turn off the background music would be a nice feature to include. 

     

  • Nedim's avatar
    Nedim
    Community Member

    To do exactly what the "Background audio" switch does (pause and play), you may follow these steps:
    1. Create a custom T/F variable and set it to True (eg. bgAudioActive = True)
    2. Insert a button with Normal and Selected state
    3. Create a trigger Execute JavaScript When the user clicks Button
    const bgAudioSwitch = document.getElementById("backgroundAudio-switch");
    bgAudioSwitch.click();
    4. Create a trigger Toggle bgAudioActive When the user clicks Button