Stopping Audio When Another Audio File Is Clicked Using Jquery While Obscuring Link
When play is pressed the file .mp3 should play when clicked again the .mp3 should stop and reset audio. If another play button is pressed while a sound is already playing it shoul
Solution 1:
I imagine something like this:
$(".play").on('click',function(){
var key = $(this).attr('key');
EvalSound(key);
});
var thissound = newAudio();
var currentKey;
functionEvalSound(key) {
if(currentKey !== key)
thissound.src = "http://designlab360.org/fhi/splash/dev2/audio/" + key + ".mp3";
currentKey = key;
if (thissound.paused)
thissound.play();
else
thissound.pause();
thissound.currentTime = 0;
currentPlayer = thissound;
}
Post a Comment for "Stopping Audio When Another Audio File Is Clicked Using Jquery While Obscuring Link"