WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WORKSFORME
205448
navigator.getGamepads() returns empty array in my WKWebView app
https://bugs.webkit.org/show_bug.cgi?id=205448
Summary
navigator.getGamepads() returns empty array in my WKWebView app
Iain
Reported
2019-12-19 07:03:47 PST
It's currently not possible to use the GamePad API within a hybrid application. Using the navigator.getGamePads() method in a WKWebview returns an empty array when a gamepad is attached, even after user interaction. Whereas Safari on the same device will return an array containing a Gamepad instance after user interaction. I tried adding the Wireless Accessory Configuration capability to the application, but it had no effect. This was the only plausible sounding capability in the list. Replication: 1. Connect gamepad to iOS device using bluetooth ( Dualshock 4 controllers are easy to setup ) 2. Load
http://luser.github.io/gamepadtest/
3. Press any button on the device ( required to "wakeup" the API ) Expected result: Page displays controller status Actual result: Nothing happens For a more minimal test you can call navigator.getGamePads() from the console and inspect the results. Application was built in Xcode 11.3 (11C29) targeting iOS 12.0 and tested on iPad Pro ( ML0H2ZP/A ) on iPadOS 13.2.3 (17B111) with Sony DS4 ( CUH-ZCT1E ).
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2019-12-20 10:42:05 PST
<
rdar://problem/58119044
>
Brady Eidson
Comment 2
2020-07-23 08:54:00 PDT
Gamepads work in Safari, and Safari is WKWebView based. There's *plenty* of WKWebView specific support to make this work. We need more specifics to find out why it's not working in your app.
Brady Eidson
Comment 3
2020-07-24 14:40:19 PDT
OH sorry - Figured it out:
> Application was built in Xcode 11.3 (11C29) targeting iOS 12.0 and tested on iPad Pro ( ML0H2ZP/A ) on iPadOS 13.2.3 (17B111) with Sony DS4 ( CUH-ZCT1E ).
It's not expected the DS4 would work on iOS 12. It's works on iOS 13+.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug