You have to press the key when the ball becomes visible. The timing is very short, you can't hold the key or spam since the cooldown is longer than the window to hit it. The timing is also not consistent with the warning, the time between the warning fades and the ball appears changes. I'm not sure how it would work on mobile, hopefully the joystick controls let you tap the screen and not swipe like the game shows, I can't imagine hitting swiping during the tight window.