sgraham / gamepad.js

Gamepad access in browsers via Gamepad API
http://www.gamepadjs.com/
255 stars 52 forks source link

Does not work in Chrome 22 or above [patch provided] #8

Open kg opened 12 years ago

kg commented 12 years ago

Apparently Chrome 22 and above (Beta, Canary) have made some sort of changes to the GamePad API. Gamepad.js works in Chrome 21 but beta and canary show 'your browser is incompatible'.

kg commented 12 years ago

Here's a fix: https://gist.github.com/3650351

inequation commented 12 years ago

Sorry to spoil your fun, but you've applied the patch to the wrong file - gamepad_uncompressed.js is just an intermediate file from the build system and would be overwritten upon next rebuild. I've merged it properly into my fork (907aa960764926b5784291f2f213846845e3f16f), you should do it against gamepad_no_images.js.

konsumer commented 11 years ago

In the interest of minimal impact to the library and simple elegance, one could also do this:

var getField = function() {
  return navigator.webkitGamepads || navigator.mozGamepads || navigator.gamepads ||
  navigator.webkitGetGamepads() || navigator.mozGetGamepads() || navigator.getGamepads();
};