HTML5 games will be supported on devices such as Xperia PLAY

Oct 10, 2012 21:41 GMT  ·  By

With the availability of Firefox 16 for Android in a stable form, all eyes turn to future releases of the mobile browser, supposedly set to bring along new features and enhancements.

Firefox 18 for Android, currently available in the Alpha channel, will be one of these, set to offer support for Game Controllers, it seems.

This is possible through the implementation of DOM_KEY_LOCATION_JOYSTICK in the browser, which expands its functionality. The fix comes from Firefox contributor Christian Vielma, Mozilla explains.

The mobile browser comes with a location attribute in DOM KeyboardEvents meant to describe the source of the key event, and the latest enhancements for the app add support for controller buttons as well.

Basically, this means that users will be able to play on their Android devices HTML5 games that require support for game controllers, such as the one present on Sony Ericsson’s Xperia PLAY smartphone.

“Firefox can determine whether a key event originated from a keyboard or a game controller using Android’s KeyEvent.isGamepadButton() API,” Chris Peterson explains in a blog post.

“Unfortunately, this API was added in Honeycomb and, unlike Google Chrome for Android, Firefox supports Android versions all the way back to Froyo. Christian wrote an isGamepadButton() “polyfill” method for use on Froyo and Gingerbread.”

The aforementioned blog post also notes that the KeyEvent.isGamepadButton() “curiously” reports false for some D-pad events, including KEYCODE_DPAD_CENTER.

No specific info on what causes this issue is available for the time being, yet Christian managed to remap the D-pad events to DOM_KEY_LOCATION_JOYSTICK, thus avoiding any problems that web developers building for the Android platform might encounter.

As mentioned above, the Firefox 18 for Android mobile browser has already arrived in the Alpha channel, and those who would like to take it for a spin will find it available for download from Softpedia as well, via this link.