JSFiddle - React, Tailwind, and code Playground
HTML
<audio id = "adi" controls>
<source src="https://ia802508.us.archive.org/5/items/testmp3testfile/mpthreetest.mp3"></source>
</audio>
<div>
<pre>
A: <span id="ts1.525487">Hi</span> , <span id="ts3.193877">how are you doing?</span>
</pre>
</div>
JavaScript
var audi = document.getElementById("adi");
audi.addEventListener("timeupdate", ()=>{
var setBackground = (elem, color)=>elem.style.backgroundColor = color,
last = undefined;
Array.from(document.getElementsByTagName("SPAN")).forEach((spn)=>{
if (!(spn.id.slice(2) < audi.currentTime)) return;
last && setBackground(last, "white");
setBackground((last = spn), "red");
})
})