How to change audio replay button color when it's playing?

Hello👋,

Is there a way to change replay button to specific color when it’s playing? I have many audios on the card and sometimes it’s difficult to know which audio is playing from. I’d appreciate any kind of help.:pray::pray:

1 Like

If you are still finding the solution

<script>
    var elem = document.querySelectorAll(".soundLink, .replaybutton");

    if (elem.length > 0) {
        elem.forEach(function (audioElement) {
            audioElement.addEventListener('click', function (event) {
                event.preventDefault(); 

                if (!audioElement.classList.contains('playing')) {
                    audioElement.classList.add('active');
                    audioElement.classList.add('playing');

                    audioElement.style.pointerEvents = 'none';

                    setTimeout(function () {
                        audioElement.classList.remove('active');
                        audioElement.classList.remove('playing');
                        audioElement.style.pointerEvents = 'auto';
                    }, 2000);
                }
            });
        });
    }
</script>

This script seems to work fine for me, but is there a way to replace 2000 with the actual audio length🤔 I’m still figuring it out, thanks🙏

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.