For some reason, my key triggers for the drum machine project are effectively triggering my audio elements and updating the display text with no detectable delay, but test #6 refuses to pass. As far as I can tell, I fulfilled the specifications to the letter, but it’s telling me that no audio plays when ‘Q’ is pressed and I get audio when I press Q. Any idea what could be causing this?
Probably not without seeing your code.
As said, we need to see your code.
Are you using the
<audio> element or an
Audio() constructor? The tests require you use the element.
Hi there, I am experiencing the same issue
This is my code: https://codepen.io/giuliapassoni/pen/poadqrQ
As per the suggestion above, I’m using the HTML audio element.
Thanks in advance for your help
@kirakira95 It would be better if you opened your own thread. Anyway.
You do not have access to
Testcomponent and there is no reason to call it inside it as you already have it listening on the document. Also, just as an aside don’t name the component Test.
You should not assign
state. Use the props directly (or create derived state from them).
- As far as I can tell, the bound function you are returning in the
keydownhandler will not be the same signature as the one you have for the event listener removal. I’d suggest binding the function in the constructor and passing the bound function to addEventListener/removeEventListener. I tested it by directly calling removeEventListener inside the
handleKeyPressat the bottom to see if it gets removed or not.
Thanks @lasjorg !
I’ll make sure to open a new thread next time (still a novice at forums, sorry!).
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.