Pomodoro clock sounds

Pomodoro clock sounds
0

So i transferred the code from codepen (https://codepen.io/script3r/pen/yLBzVLP) to visual studio code and then uploaded it on github (https://github.com/scr1pter/countdown-timer) (there is a heroku link there) and its weird that everything is fine except the audio beep. The sounds are playing in codepen with all tests passing but not in localhost with visual studio code or heroku. I tried playing the audio with the ref like in the example of the project challenge and also tried binding the ref in constructor with React.createRef() but nothing changes.

1 Like

it turns out for some reason the sound was not playing with $('audio#beep')[0].play() in VSC localhost, but it was playing with this way at codepen.Anyway i managed to get it to play with document.getElementById('beep').play() but it would be nice to know why the first jquery method was not working.

1 Like

maybe you forgot to add the jquery cdn to your html when you transferred it?

1 Like

i tried to add jquery from terminal npm but nothing. i didnt have errors in VSC, it was just the sounds not playing at all. ill try to add the script tag with the link as you said and i will inform you about the result

You could add jquery in index.html in your public directory. Or when you installed jquery as dependancy didn’t import in you index.js correctly? As for playing sound in pomodoro, in my own i just added audio tag with ref and just played it this.myRef.current.play();.

1 Like

this one worked. Im new to VSC and it works in mysterious ways, as i said i installed jquery by terminal but it didnt work. Thanx!

1 Like