How do I autostop the first audio/media clip once the first one is playing? | XM Community
Skip to main content

I want to have three different audio clips on a page for comparison. I would like it so that if the user presses the button to play audio clip 2 while audio clip 1 is playing, audio clip one pauses or stops so that there is only one audio clip playing at a time. Is this possible?

PS: I should have API access in a day or two if that allows for this feature!

Put this code in the JS onReady function:
jQuery("audio").bind("play",function (){
jQuery("audio").not(this).each(function (index, audio) {
audio.pause();
});
});


Leave a Reply