zeeguu / web

Frontend for the zeeguu web application.
https://www.zeeguu.org
3 stars 5 forks source link

Fixed the animation for Speech buttons #303

Closed tfnribeiro closed 6 months ago

tfnribeiro commented 6 months ago

After adding the new SpeechAPI we are not animating the buttons currently, they change state for a few ms and not accurately animate until the speech ends. It seems that Audio creates an event on "ended" which should be where we revert the status.

While doing this change, I have also changed the logic on how the spell what you hear works. Instead of calling the timeout at the beginning of useEffect, instead wait until the articleInfo is loaded and then fire a shorter timeout. Now, the button also correctly animates when playing a sound.