TV specific keys in browser¶
Suitest allows the use of regular browsers for launching HbbTV and other TV apps, this is very useful for quick testing if you do not yet have access to a CandyBox or do not have access to a TV at the moment.
Important: Suitest does not create compatibility of the application with browsers or vice-versa. Your application will function exactly the same as if it is running without Suitest.
It is common for TV applications to respond to special keys that are not on a traditional keyboard such as Red, Blue, Pause, Play. That is why we need to send different key codes to the browser to replace these special keys. The applications developers need to implement, that the application can recognize these replacement keys when it is being operated with SuitestDrive.
Example: When the Back button is pressed on a remote, HbbTV expects code 461, Tizen expects 10009 and Samsung Orsay expects 88. Suitest uses code 461 as the Back button as it is the most commonly used.
As seen above in the example, using a traditional keyboard to interact with the browser will not allow the control of the application within the browser, without using replacement key codes. To create compatibility you can bind keyboard keys to TV remote buttons to allow you to control your app within the browser.
Your application will receive the following key codes when the browser is operated by SuitestDrive:
| Tv Remote Button | Key code (hex) | Key code (decimal) | Keyboard button name |
|---|---|---|---|
| Back | \u01CD | 461 | - |
| Blue | \u0196 | 406 | - |
| Down | \u0028 | 40 | Down arrow |
| Fast Forward | \u01A1 | 417 | - |
| Green | \u0194 | 404 | - |
| Left | \u0025 | 37 | Left arrow |
| OK | \u000D | 13 | Enter |
| Pause | \u019B | 411 | - |
| Play | \u019F | 415 | - |
| Play/Pause | \u01F7 | 503 | - |
| Red | \u0193 | 403 | - |
| Rewind | \u019C | 412 | - |
| Right | \u0027 | 39 | Right arrow |
| Stop | \u019D | 413 | - |
| Up | \u0026 | 38 | Up arrow |
| Yellow | \u0195 | 405 | - |
Subscribing to key events
Unfortunately browsers emit the key events inconsistently, so if you are trying to achieve consistent browser compatibility with your TV application you may need to experiment a bit until you achieve the desired behavior.
Mozilla Firefox sets the keyCode to 0 in a keypress event. However the
which property is set correctly.
Google Chrome comes with two surprises:
-
For the arrow keys the
keypressevent is not dispatched at all. -
In the
keyuporkeydownevent the value ofevent.which,event.keyCodeandevent.charCodeis 0 for all keys from the above table.