Pomodoro (25 + 5 Clock) challenge error

Hello all, I need a help pls, so I have follow the frontend lib curriculum, and I almost finished all of the last challenge (25 + 5 Clock), but I always face the same problem, I’ve tried to read any other similar topics and it still doesn’t work, please help me :pray:

The problem :

When a countdown reaches zero (NOTE: timer MUST reach 00:00), a sound indicating that time is up should play. This should utilize an HTML5

Timer has reached zero but audio is not playing while it should.: expected true to be false

my running server : fcc-frontend-lib-challenge.vercel.app/pomodoro
the code in git hub : /nov4n-4r/fcc-frontend-lib-challenge/blob/master/src/projects/pomodoro_clock.jsx

sorry I’m unable to give the clickable link

  1. Remove the setTimeout code from playAudio.

  2. stopAudio needs to set currentTime back to 0

thanks, I’ve do that, but still face the same issue

thanks guys for the concern, I’ve fix it with add onTimeOut callbacks
so its from this :

    function startTimer(){
        if(!Boolean(timer)) return setTimer(
            setInterval(() => {
                setTime(prev => {

                    if(prev - 1 >= 0){
                        return prev - 1
                    }else if(prev - 1 === 0){
                        return 0
                    }else{
                        setRest(prev => !prev)
                        return 0
                    }

                })
            }, 1000)
        )
    }

to this :

    function startTimer(){
        if(!Boolean(timer)) return setTimer(
            setInterval(() => {
                setTime(prev => {

                    if(prev === 0){
                        setRest(prev => !prev)
                        return 0
                    }

                    if(prev - 1 > 0){
                        return prev - 1
                    }else{
                        onTimeOut()
                        return 0
                    }
                })
            }, 1000)
        )
    }

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