Forum Discussion
Audio on States - is there a way to stop it
- 2 years ago
Try creating a T/F variable called togAudioPauseAll.
Then create an Execute JavaScript trigger and inserting the following code:
const audioList = document.querySelectorAll("audio");for (let i = 0; i < audioList.length; i++) { audioList[i].pause(); }Set this trigger to fire when togAudioPauseAll changes.
Whenever the user clicks a new box/button/whatever, use an Adjust Variable trigger to toggle togAudioPauseAll.
This should stop all playing audio on the slide. Doing this before playing another audio clip lets you kill whatever audio is playing before the new one starts. It avoids having to create a bunch of individual triggers.
I ran into this recently when creating a training, and the way I got the audio to stop was to do a trigger to "Stop Media" when "User Clicks" and that seemed to resolve it pretty simply.
Related Content
- 6 months ago
- 12 months ago