Proof of concept for reading gamepad input using the browser Gamepad API.
https://electrovir.github.io/gamepad-poc/
git clone https://github.com/electrovir/gamepad-poc.git
cd gamepad-poc
npm install
npm start
Open your browser to http://localhost:61016, or whatever URL is printed on your terminal after Local:
.
tl;dr: Chrome or Chromium in Electron is the most consistent experience, even if it does not follow the expected specs. (For example, Chrome has a hard max of 4 controllers.)
Empty spots will be filled in over time. Feel free to contribute!
OS | OS version | Browser | Browser version | Wired Xbox 360 Controller | Wireless Xbox 360 Controller | Switch Pro Controller via Bluetooth | PS5 DualSense via Bluetooth |
---|---|---|---|---|---|---|---|
macOS | Big Sur 11.5.1 | Safari10,11 | 14.1.2 | ❌ 1 | ❌ 4 | ✅ 3,8,9 | |
macOS | Big Sur 11.5.1 | Chrome7,12 | 92.0.4515.107 | ✅ 2 | ❌ 4 | ✅ 3 | |
macOS | Big Sur 11.5.1 | Firefox | 90.0.2 | ❌ 1 | ❌ 4 | ❌ 13 | |
macOS | Big Sur 11.5.1 | Chromium in Electron7,12 | 91 in 13.1.7 | ✅ 2 | ❌ 4 | ✅ 3 | |
macOS | Monterey 12.5.1 | Safari | 15.6.1 | ✅ | |||
macOS | Monterey 12.5.1 | Chrome | 104.0.5112.101 | ❌ 1 | |||
macOS | Monterey 12.5.1 | Firefox | 103.0.2 | ❌ 1 | |||
Ubuntu | 20.04 | Chrome7,12 | 92.0.4515.107 | ✅ | ✅ | ||
Ubuntu | 20.04 | Chromium7,12 | 92.0.4515.107 | ❌ 6 | ❌ 6 | ||
Ubuntu | 20.04 | Firefox | 90.0 | ✅ 5 | ✅ | ||
Ubuntu | 20.04 | Chromium in Electron7,12 | 91 in 13.1.7 | ✅ | ✅ | ||
Windows | 10 | Chrome7,12 | 92.0.4515.131 | ✅ | ✅ | ||
Windows | 10 | Firefox14 | 90.0 | ✅ 10 | ✅ 10 | ||
Windows | 10 | Edge7,12 | 92.0.902.62 | ✅ | ✅ | ||
Windows | 10 | Chromium in Electron7,12 | 91 in 13.1.7 |
vibrationActuator
nulled out in Chromium browsers. (This is really bad for Chromium because it means only 2-3 players can connect.)navigator.getGamepads()[0].vibrationActuator.playEffect('dual-rumble', {duration: 1000, strongMagnitude: 1, weakMagnitude: 1}).then(result => console.log(result)).catch(error => console.error(error))
-
button is super laggy and the screenshot button does not get picked up at all. (Sometimes these buttons try to trigger Safari screen recording.)requestAnimationFrame
) when it's not the focused app (in the background). Other browsers will continue to update.Each controller is named something slightly different in each situation.
OS | OS version | Browser | Browser version | Wired Xbox 360 Controller | Wireless Xbox 360 Controller | Switch Pro Controller via Bluetooth | PS5 DualSense via Bluetooth |
---|---|---|---|---|---|---|---|
macOS | Big Sur 11.5.1 | Safari | 14.1.2 | - | - |
57e-2009-Pro Controller (bad) and Pro Controller Extended Gamepad (good) |
|
macOS | Big Sur 11.5.1 | Chrome | 92.0.4515.107 | Xbox 360 Controller (STANDARD GAMEPAD Vendor: 045e Product: 028e) |
- |
Pro Controller (STANDARD GAMEPAD) (bad) and gamepad: Pro Controller (STANDARD GAMEPAD Vendor: 057e Product: 2009) (good) |
|
macOS | Big Sur 11.5.1 | Firefox | 90.0.2 | - | - | - | |
macOS | Big Sur 11.5.1 | Chromium in Electron | 91 in 13.1.7 | Xbox 360 Controller (STANDARD GAMEPAD Vendor: 045e Product: 028e) |
- |
Pro Controller (STANDARD GAMEPAD) (bad) and gamepad: Pro Controller (STANDARD GAMEPAD Vendor: 057e Product: 2009) (good) |
|
macOS | Monterey 12.5.1 | Safari | 15.6.1 | DualSense Wireless Controller Extended Gamepad |
|||
macOS | Monterey 12.5.1 | Chrome | 104.0.5112.101 | ||||
macOS | Monterey 12.5.1 | Firefox | 103.0.2 | ||||
Ubuntu | 20.04 | Chrome | 92.0.4515.107 | ||||
Ubuntu | 20.04 | Chromium | 92.0.4515.107 | ||||
Ubuntu | 20.04 | Firefox | 90.0 | ||||
Ubuntu | 20.04 | Chromium in Electron | 91 in 13.1.7 | ||||
Windows | 10 | Chrome | 92.0.4515.131 | Xbox 360 Controller (XInput STANDARD GAMEPAD) |
Xbox 360 Controller (XInput STANDARD GAMEPAD) |
||
Windows | 10 | Firefox | 90.0 | xinput |
xinput |
||
Windows | 10 | Edge | 92.0.902.62 | Xbox 360 Controller (XInput STANDARD GAMEPAD) |
Xbox 360 Controller (XInput STANDARD GAMEPAD) |
||
Windows | 10 | Chromium in Electron | 91 in 13.1.7 |