简体   繁体   English

Navigator.getGamepads() 不会返回同一类型游戏手柄的不同实例

[英]Navigator.getGamepads() doesn't return different instances of the same type of gamepad

As the title says, I don't get 2 different gamepads for the same type of controller (yes, I can see them in the Control Panel joy.cpl )正如标题所说,我没有为相同类型的 controller 获得 2 个不同的游戏手柄(是的,我可以在控制面板joy.cpl中看到它们)

ie using Windows I can see in joy.cpl the following list:即使用 Windows 我可以在joy.cpl中看到以下列表:

Controller (XBOX 360 for Windows)
Saitek Pro Flight X-56 Rhino Stick
Saitek Pro Flight X-56 Rhino Throttle
6B Controller
6B Controller

while in Chrome (v84) I only get this:在 Chrome (v84) 中,我只得到这个:

Array.from(navigator.getGamepads()).map(g => g.id);
// [
//  "Xbox 360 Controller (XInput STANDARD GAMEPAD)"
//  "6B controller (Vendor: 0ca3 Product: 0024)"
//  "Saitek Pro Flight X-56 Rhino Throttle (Vendor: 0738 Product: a221)"
//  "Saitek Pro Flight X-56 Rhino Stick (Vendor: 0738 Product: 2221)"
// ]

I was trying to investigate how to differentiate them if there were the same type, but it comes that I don't even get them...我试图研究如果有相同的类型如何区分它们,但结果我什至没有得到它们......

Any way to get the 2nd 6B Controller ?有什么办法可以得到第二个6B Controller吗?

Edit After testing with a newer Chrome version, I can confirm that is working now... so probably was an issue in an older version and it's fixed:)编辑在使用较新的 Chrome 版本进行测试后,我可以确认它现在可以正常工作......所以可能是旧版本中的问题并且已修复:)

I just did a quick test and plugged in two identical gamepads into my machine, and both were detected:我只是做了一个快速测试并将两个相同的游戏手柄插入我的机器,并且都被检测到:

0: Gamepad {id: "Xbox 360 Controller (STANDARD GAMEPAD Vendor: 045e Product: 028e)", index: 0, connected: true, timestamp: 222286.67000000132, mapping: "standard", …}
1: Gamepad {id: "Xbox 360 Controller (STANDARD GAMEPAD Vendor: 045e Product: 028e)", index: 1, connected: true, timestamp: 245434.25500000012, mapping: "standard", …}

Have you tried waking both controllers up (by pressing a button) before calling navigator.getGamepads() ?在调用navigator.getGamepads()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM