Developer Console

Supporting Controllers in Web Apps (Fire TV)

Amazon Fire TV supports user input from the Amazon Fire TV remote, the Amazon Fire game controller, and other game controllers that support the Bluetooth HID gamepad profile. These controllers give users a means of navigating in your app and selecting items.

Using Input from the Amazon Fire TV Remote

Most Amazon Fire TV remote controls have these buttons. Some Fire TV remotes do not include the microphone or voice search buttons.

Remote control
Remote control

Some remote controllers have additional buttons — such as volume up/down, power, Netflix, Amazon Prime, and other apps. However, these buttons can't be mapped to events in third-party apps.

To enable users to interact with your web app by using the remote, you need to capture the key events when users press one of the keys. Most key presses can be captured just as standard keyboard events in a browser.

For keycode mappings, see the following table. The Home, Menu, and Voice Search buttons cannot be captured.

Amazon Fire TV Remote Button Key Code Standard Behavior
Select (D-Pad Center) 13 Selects the user interface item with the current focus.
Up (D-Pad) 38 Moves the focus upward in the user interface.
Down (D-Pad) 40 Moves the focus downward in the user interface.
Left (D-Pad) 37 Moves the focus left in the user interface.
Right (D-Pad) 39 Moves the focus right in the user interface.
Play/Pause 179 Controls media playback. Play/Pause is a toggle.
Rewind 227 Rewinds or skips backwards in media playback contexts.
Fast Forward 228 Fast Forwards or skips ahead in media playback contexts.
Back 4 Navigates back in the history stack or back to home screen if the history stack is empty.

These key events are sent only to apps that are in focus.

Using Input from the Amazon Fire Game Controller

Developing for the Amazon Fire Game Controller is straightforward:

  • Amazon WebView supports the W3C standard Gamepad APIs.
  • The buttons on the Amazon Fire Game Controller map to the standard gamepad format.
  • In using the Gamepad APIs with the Amazon Fire Game Controller, the Back button is equivalent to Select on a standard controller, and the Menu button is equivalent to Start. If you do not use the Gamepad APIs, the buttons behave as Back and Menu buttons.

For more information on developing for the Standard Gamepad APIs, see Jumping the Hurdles with the Gamepad API.

If you choose not to use the Gamepad APIs, the buttons on the Amazon Fire Game Controller generally map to the same functions as on the Amazon Fire TV Remote (other than the B button).

The Amazon Fire TV (2nd Gen) Game Controller has these buttons:

The Amazon Fire TV (1st Generation) Game Controller has these buttons:

The following table shows the key mappings.

Amazon Gamepad Controller Button Key Code Standard Behavior
Up (D-Pad/Joystick) 38 Move the focus upward in the user interface.
Down (D-Pad/Joystick) 40 Move the focus downward in the user interface.
Left (D-Pad/Joystick) 37 Move the focus left in the user interface.
Right (D-Pad/Joystick) 39 Move the focus right in the user interface.
A 13 Select the user interface item with the current focus.
B 8 None
X 13 Select the user interface item with the current focus.
Y 13 Select the user interface item with the current focus.
Back 4 Navigates back in the history stack or back to home screen if the history stack is empty.

Play/Pause Media Button

A requirement for all media apps submitted for Amazon Fire TV is that they handle the media Play/Pause key events to control media playback. All Game applications must also handle the media Play/Pause key events to play or pause the game. The key code for the Play/Pause button is 179.

Back Button

When a user presses the Back button in a web app on a Fire TV, the web app receives a standard Android key event from the KeyEvent class. For details on how to capture key events on the Fire TV remote, see Remote Control Input. For details on how to capture key events on the Amazon Fire Game Controller, see Game Controller Input.


Last updated: Aug 30, 2023