This content has been marked as final.
Show 1 reply
-
1. Re: audio - toggle on/off multiple sounds even when they are not currently playing
robboerman Mar 28, 2014 8:46 AM (in response to resdesign)didn't have the time to test this code yet.
but it should work.
Html5 audio can not be accessed by class, it can only be accessed by id.
so i made this code
$( "audio" ).each(function() {
var a = $(this).attr("id");
var audioPlayer = document.getElementById(a)
audioPlayer.pause();
audioPlayer.currentTime = 0;
});
this will find the id of the audios and pause them and reset the time to 0
( not really a way to officially stop audio )
or you van just mute it with this code
$( "audio" ).each(function() {
var a = $(this).attr("id");
var audioPlayer = document.getElementById(a)
audioPlayer.muted = true;
});
- Rob



