Here is the link to the codpen
I can’t get both User Tests 28 and 29 to pass at the same time. The error begins User Test 29 (the third audio test):
3. The audio element with id of “beep” must stop playing and be rewound to the beginning when the element with the id of “reset” is clicked.
First thing is I don’t understand the error. The sound does stop when reset is pressed. But I was able to remove the error by manipulating the src attribute of the audio tag
handleReset() {
//...
let aud = document.getElementById("beep")
if (!aud.paused) {
aud.pause();
aud.currentTime = 0;
aud.src = ''
//..
}
And then resetting the src attribute just as it plays in the tick ()method as it plays
tick() {
//...
let aud = document.getElementById("beep");
aud.src = alarm;
aud.play();
}
//...
That worked to get the test to pass but caused user Story 28 to fail:
2. The audio element with id=“beep” must be 1 second or longer.
At that point I substituted an 8 second sound just to be sure it was long enough. As it stands now I can pass one test or the other by including, or commenting, the line in handleReset()
aud.src = '';
Please help me to fix this.
(If you have followed it all the way to here, note that tick interval is set to 1/10 second to save your time when testing the program)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36.
Challenge: Build a Pomodoro Clock
Link to the challenge:
https://www.freecodecamp.org/learn/front-end-libraries/front-end-libraries-projects/build-a-pomodoro-clock