Forum Discussion
Use Javascript to toggle sound
- 5 months ago
Thanks Ian, I will give it a try.
Several years back I started with this conversation (which links to another conversation) , because I need the volume of a looping audio file to gradually increase at certain points in an activity, until it was at 150%:
First, I retrieved the current value from volumeSlider and parked that for later. At the same time, I set a new variable's value, decVolume, to 0.05. Then, I increased decVolume in JavaScript, and fed that into the course using SetVar. Once the activity was complete, I reset volumeSlider to its original value.
In theory, you could set decVolume to 0.00, which should mute the audio. It would still play, but nothing would come out of the speakers.
- JeffreyRiley-9e5 months agoCommunity Member
JoeFrancis, thanks for the reply and I will look this over. I also used ChatGPT to give me a javascript that would work and it did.
Related Content
- 10 months ago