Forum Discussion
Use Javascript to toggle sound
Does anyone have suggestions for using javascript to toggle sound on and off in a course? Specifically looking to use text to speech and then give the participant the ability to listen to or no listen to the voice on the slide. I have been doing this with triggers but would javascript be better of give me more control?
Thanks Ian, I will give it a try.
5 Replies
- JeffreyRiley-9eCommunity Member
I just tried it and it works the way I want. Thanks for the heads up. I also follow NRZ Malik so I am not surprised it works!
- IanColemanCommunity Member
Jeffrey,
I have used this before and it works quite well. Hope it helps.
How to add a custom Mute/Unmute button in Storyline- JeffreyRiley-9eCommunity Member
Thanks Ian, I will give it a try.
- JoeFrancisCommunity Member
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-9eCommunity 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.