Forum Discussion
HoneyTurner
7 months agoCommunity Member
Muting Audio in Timeline
I'm creating a slide that includes a Text 2 Speech introduction, theme music, then Text 2 Speech instructions.
I would like to add a toggle to the page that will allow the user to mute the theme mu...
- 7 months ago
There are multiple ways to detect an audio file name. For now, I’ll focus on one way.
Execute the following JavaScript global function when the timeline starts on this slide:window.muteAudio = function(filename) { var audioElements = document.querySelectorAll('audio'); audioElements.forEach(function(audio) { const audioFileName = audio.src.split('/').pop(); const audioFilePath = `story_content/${filename}`; if (audio.src.includes(audioFilePath)) { audio.muted = !audio.muted; } }); };
- Publish your file to Web.
- Open the published folder and navigate to the story_content directory.
- Copy and paste the exact filename of the audio file you want to control.
Now, you can mute or unmute the specific audio file by executing JavaScript when the user clicks toggle button:
muteAudio('your-audio-file.mp3');
HoneyTurner
7 months agoCommunity Member
Thanks for the link. That conversation seems to be about muting all audio. I'm not sure how to convert that to a single audio file. I've added a comment on there to see if they can help with that conversion.
Related Content
- 3 months ago