Gamepad API polling can miss events/clicks
Reported by
marc...@gmail.com,
May 16 2018
|
||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36 Steps to reproduce the problem: 1. go to http://html5gamepad.com/ 2. rapidly click a button, most noticeable on the dpad of my xbox 360 controller 3. see that some presses do not register What is the expected behavior? get every click/pressed event from gamepad input What went wrong? I am assuming that the button being pressed happens between two polling events. It is also not entirely impossible that the gamepads is at fault, but I have tried two different gamepads and dpad-down skipped a few times Did this work before? No Does this work in other browsers? N/A Chrome version: 66.0.3359.181 Channel: stable OS Version: 6.1 (Windows 7, Windows Server 2008 R2) Flash Version:
,
May 16 2018
This is expected behavior because the Gamepad API requires sites to poll for button status rather than being event-based. Fixing this issue should start with the Gamepad API specification: https://github.com/w3c/gamepad/
,
May 16 2018
Note that html5gamepad.com polls gamepads in a requestAnimationFrame loop. The gamepad hardware is polled more frequently than the default rAF loop, so if you are missing inputs I would recommend using a faster loop than rAF.
,
May 16 2018
I've used setTimeout(..., 5) but have switched to setInterval(..., 5) and that seems to be working better. If there is already internal polling going on, it would be nice to directly interact with that loop. Everything else just adds lag and unexpected behavior. Thanks for your time and answer! |
||
►
Sign in to add a comment |
||
Comment 1 by viswa.karala@chromium.org
, May 16 2018