Is there any way to create Audio mute/unmute button in articulate by using javascript?

in my  slide have three to four audios.for example look like this

i want to create my own mute/unmute button.when i click mute button audio sound off and when i click unmute button audio sound on.

i want to control three audios with single mute and unmute button.

If any one know pls help me....

Thank you.

Anitha

 

 

15 Replies
David Arndt

Hi Anitha,

have you had a look at the sample file I uploaded in the threat Matthew referenced above? You should be able to create a single mute/unmute toggle button for multiple audios with that and the script I posted later in that thread:

var allAudios = document.getElementsByTagName('audio');
if (allAudios[0].volume > 0) {
for (var a = 0; a < allAudios.length; a++) {
allAudios[a].volume = 0;
}
} else {
for (var a = 0; a < allAudios.length; a++) {
allAudios[a].volume = 1.0;
}
}


For javascript integration in general, there's an introduction by Articulate: https://articulate.com/support/article/javascript-best-practices-and-examples

Swapnil Bharsakale

var allAudios = document.getElementsByTagName('audio');
if (allAudios[0].volume > 0) {
for (var a = 0; a < allAudios.length; a++) {
allAudios[a].volume = 0;
}
} else {
for (var a = 0; a < allAudios.length; a++) {
allAudios[a].volume = 1.0;
}
Hi David, This code is not working when I view the course online/On web server  in Chrome browser.