The audio does not play when the break timer ends it seems.
When using React.useState(new Audio(…)) the audio plays back to back, but using the html audio tag doesn’t seems to work.
I would be very grateful for any insight !
Thank you in advance !!
Then playing the audio by calling audioBeep.play(), breaks something in the timing of the interval thus not transitioning into break properly or session properly unless Start / Pause button was not pushed at least once during the count down.
The proper way was to use:
const audioBeep = React.useRef(null);
ref = {audioBeep}
Then when referring to the audio, use audioBeep.current.play() etc…
I first resorted to the first version as I was told that refs do not work in function as functions do not have instance.
Here is what I believe and might want confirmation:
In this case, since we are setting an interval, the DOM is re-rendered thus creating instances making the ref work.