gamepad API progress ?

123 views
Skip to first unread message

Toad

unread,
Feb 6, 2012, 4:10:27 PM2/6/12
to Chromium-discuss
Hello -

I saw Eric Bidelmans excellent "The Edge of HTML5" slide deck
(http://html5-demos.appspot.com/static/html5-therealbleedingedge/
template/index.html#27)
and its references to the gamepad API, i.e.

navigator.webkitGamepads || navigator.MozGamepads

and the events

window.addEventListener('webkitgamepadconnected', onConnected,
false);
window.addEventListener('webkitgamepaddisconnected',
onDisconnected, false);

window.addEventListener('MozGamepadDisconnected', onDisconnected,
false);
window.addEventListener('MozGamepadConnected', onConnected, false);


I am on a Mac, latest Snow Leopard, with latest Chromium Canary
(18.0.1025.6) and am trying to get this to work.

Specifically I would love to be able to drive the Google Earth browser
plugin with a 3DConnexion Space Navigator (http://www.3dconnexion.com/
products/spacenavigator.html) or a Logitech Wingman Extreme 3D
joystick.
Both work in the regular Google Earth App, so I know they are
connected as far as OS is concerned.

In chromium, I can reference the navigator.webkitGamepads property and
get:
GamepadList
0: undefined
1: undefined
2: undefined
3: undefined
length: 4

Not sure what that length 4 array means. But anyway, I cannot get
those events to fire (wildly moving joystick and pressing buttons) and
therefore anything to work. (I also tried in latest Firefox Nightly
13.0a1 2012-02-06, same nothing)

Is it supposed to work already and I am making a mistake or is it just
not quite there yet ?

BTW, I DID enable Gamepad (and Pointer lock) in about:flags in my
Canary

Any tips (or implementation timeline) appreciated !

Also, is the gamepad API going to make it into webkit nightlies and
perhaps Safari ? Just thinking about deployed base of this feature...

THANKS !


---
PS my test script (just in case i screwed that up and someone spots
it)

navigator.gamepads = navigator.webkitGamepads ||
navigator.MozGamepads;
var controllers = {}; // Stash connected controllers.
var reqId = null;

function onConnected(e)
{
console.log( "Controller connected !" );
console.log( e );
controllers[e.gamepad.index] = e.gamepad;
}

function onDisconnected(e)
{
console.log( "Controller DISconnected !" );
console.log( e );
delete controllers[e.gamepad.index];
}

window.addEventListener('webkitgamepadconnected', onConnected, false);
window.addEventListener('webkitgamepaddisconnected', onDisconnected,
false);

window.addEventListener('MozGamepadDisconnected', onDisconnected,
false);
window.addEventListener('MozGamepadConnected', onConnected, false);

Scott Graham

unread,
Feb 6, 2012, 4:41:08 PM2/6/12
to 135...@gmail.com, Chromium-discuss
On Mon, Feb 6, 2012 at 1:10 PM, Toad <135...@gmail.com> wrote:

In chromium, I can reference the navigator.webkitGamepads property and
get:
GamepadList
0: undefined
1: undefined
2: undefined
3: undefined
length: 4

If there's no data showing up in navigator.webkitGamepads after you've pressed a "primary button" (one of the first 4) then there must be some problem in reading data from the devices or in their connection to the OS. Unfortunately I don't have either of those devices available and I'm not sure about the state of drivers for them on OS X. I'll see if I can find either or both locally.
 
 

Not sure what that length 4 array means. But anyway, I cannot get
those events to fire (wildly moving joystick and pressing buttons) and
therefore anything to work. (I also tried in latest Firefox Nightly
13.0a1 2012-02-06, same nothing)


You might try this build for FF: http://people.mozilla.com/~tmielczarek/mouselock+gamepad/. I don't know what versions/builds of FF have it other than that one, but that could tell us whether it's a OS-level or Chrome-level problem that you're seeing.

scott

Sylvain Zimmer

unread,
Dec 20, 2012, 10:11:40 PM12/20/12
to chromium...@chromium.org, 135...@gmail.com
Hi guys,

I just created a bug for this after finding a workaround for connecting the SpaceNavigator:

Scott, I know there are often such devices in Google offices for Liquid Galaxy installs, maybe you can grab one to test ;)

Cheers!
Reply all
Reply to author
Forward
0 new messages