Here is the results of a few tests I ran on various "TV browsers" environments.
I wanted to know how those TV environements behaves regarding keyboard events. Is there a reliable standard way of handling remote controllers that we can work with?
The simple JS script I used to test keyCode behavior is available here : jsbin.com/OqAhIcA/13
Tested devices :
- Desktop Browser (Chrome 30)
- Opera TV Emulator
- MediaTek TV Box
MT8560: a low cost device, not even referenced on the vendor website that runs aOpera 12browser - Samsung 40' LED TV (aka "Smart TV") with built-in browser. Seems to be a Webkit based browser, whatbrowser.org reports it as a
Webkit Nightly 535
As you can read below, keyCodes seems to be pretty standard when it comes to arrows keys and OK/Enter key. That's the good news. The bad news is thoses 5 buttons are the only reliable ones.
| Key | Browsers | Box mediaTek | Opera TV Emulator | Samsung "Smart" TV |
|---|---|---|---|---|
| ARROW_LEFT | 37 | 37 | 37 | 37 |
| ARROW_UP | 38 | 38 | 38 | 38 |
| ARROW_RIGHT | 39 | 39 | 39 | 39 |
| ARROW_DOWN | 40 | 40 | 40 | 40 |
| ENTER | 13 | 13 | 13 | 13 |
| Key | Browsers | Box mediaTek | Opera TV Emulator | Samsung "Smart" TV |
|---|---|---|---|---|
| BACKSPACE | 8 | na | na | na |
| MENU | 109 ('m') | na | 462 | 116 (Tools) / 120 (Info) |
| BACK | 27 ('ESC') | na | 8 ('back') | np |
| Key | Browsers | Box mediaTek | Opera TV Emulator | Samsung "Smart" TV |
|---|---|---|---|---|
| PLAY | 119 (F8) | nb | 415 | 121 |
| STOP | na | na | 413 | 118 |
| PAUSE | 119 (F8) | nb | na | 123 |
| FAST_FORWARD | na | nb | 417 | 20000077 (long press) |
| FAST_REWIND | na | nb | 412 | 20000074 (long press) |
| PREVIOUS | 118 (F7) | nb | na | nb |
| NEXT | 120 (F9) | nb | na | nb |
| RED | na | 34 | 403 | 112 |
| GREEN | na | nb | 404 | 113 |
| YELLOW | na | nb | 405 | 114 |
| BLUE | na | 33 | 406 | nb |
na (not available) : eg, no such button on the device
nb (not bound) : the button exists on the device but don't trigger any event
np (not prevented) : the event triggers but propagation can't be stopped
Special notes:
- Surprisingly, color buttons are not always available, sometimes you'll only have 2 or 3 of them.
- On the Samsung TV, you need to manually switch from 'pointer navigation' (default) to 'link navigation' to activate keyboard/remote events. otherwise mouse events are the only ones triggered.