+ 1

Music player issue

Hi, I am facing some issues , when building the music player. I have followed a youtube tutorials, and everything was going fine, but when I started writing JavaScript, the issue came up, as the youtube tutorial showed that if we press the play button, the pause button should come up. I have spotted some possible issues of why this issue is coming. I have also noticed, that my audio is not working, even when the link is functional. Can somebody please help me to fix this issue? Thank you. This is my code: https://www.sololearn.com/compiler-playground/WqAw6cE1k2IE Link to the youtube tutorial I have followed: https://www.youtube.com/watch?v=JtrFzoL1joI

28th Apr 2023, 8:42 AM
Danish Zubair
Danish Zubair - avatar
1 Resposta
+ 6
let progress = documnet.getElementById("progress"); there is a typo in the word "document". It should be "document" instead of "documnet". This is causing the "progress" variable to not be defined properly, which could lead to issues with updating the progress bar. Also in this line: if(ctrlIcon.classList.contains("fa-pause")){ you're trying to access the "control-icon" element using "ctrlIcon" variable. You should update it to use "ctrlIcon" instead of "control-icon". And the audio part: you're trying to check if the audio is playing by using the "play" function. Instead, you should use the "playing" property of the audio element to check if it's currently playing. Here's the updated code with these changes: https://code.sololearn.com/Wb1uxEwKta5h/?ref=app it should work fine now😁👍
28th Apr 2023, 11:45 AM
Sadaam Linux
Sadaam Linux - avatar