Using Firefox with a joystick
Work on the JoystickAPI is progressing: the first special build of the Firefox web browser that has a rudimentary set of DOM joystick events has now been released. This means that web content in the browser can receive input from a joystick or gamepad. Together with with the Bocoup web development agency, Ted Mielczarek and David Humphrey from Mozilla have developed two early prototypes to demonstrate the possible applications.
The new API can be used to control a video or, in conjunction with graphics framework Paper.js, move a point around the screen using the joystick. Supported hardware is a little limited – the current implementation is only suitable for Microsoft's Xbox 360 controller.
Mozilla's JoystickAPI currently defines three events: MozJoyButtonDown
, MozJoyButtonUp
and MozJoyAxisMove
. They share a JoystickID property, which enables the API to distinguish between connected devices. In contrast to the polling-based approaches which Google has chosen to use for its Joystick API, Mozilla's method for status updates is managed through receiving DOM events.
According to Bocoup, this can lead to occasional buffer overloads, especially when querying analogue sticks. Problems could also arise if a large number of different devices need to be supported by the API at a later date. A dedicated JavaScript library should, however, make up for these shortcomings at a future date.
(crve)