• Quick Start
  • Booting
  • Platform
  • Portals
  • References
    • API Reference TOI3
    • IIP Reference
  • Resources
ARRIS Enterprises, Inc. Confidential Information

Handling Input

The KreaTV IP-STB software supports input handling through standardized JavaScript DOM level 3 event model using the KeyboardEvent interface.

The key identifiers generated from key presses on the remote control and keyboard correspond, as closely as possible, to the list of Keyboard events and key identifiers as specified by W3C.

However, the remote control may have buttons that are not found on a regular PC keyboard. These unique buttons are translated by the driver to a series of key identifiers according to the following tabe:.

Button nameKey identifier
STANDBYSee note below
INFO"Info" (as by W3C)
OK"Accept" (as by W3C)
TV"TV" (as by W3C)
WWW"Web"
Text"Teletext" (as by W3C)
EPG"EPG"
RED"Red"
GREEN"Green"
YELLOW"Yellow"
BLUE"Blue"
PORTAL"Portal"
BACK"BrowserBack" (as by W3C)
MENU"Menu"
ARROW_UP"Up"
ARROW_DOWN"Down"
ARROW_LEFT"Left"
ARROW_RIGHT"Right"
SCROLL_UP"ScrollUp"
SCROLL_DOWN"ScrollDown"
SCROLL_LEFT"ScrollLeft"
SCROLL_RIGHT"ScrollRight"
VOLUME+"VolumeUp" (as by W3C)
VOLUME-"VolumeDown" (as by W3C)
VOLUME_MUTE"VolumeMute" (as by W3C)
CH+"ChannelUp" (as by W3C)
CH-"ChannelDown" (as by W3C)
PLAY_PAUSE"MediaPlayPause" (as by W3C)
MEDIA_STOP"MediaStop" (as by W3C)
REWIND"MediaRewind" (as by W3C)
FAST_FORWARD"MediaForward"
MEDIA_PREVIOUS"MediaPreviousTrack" (as by W3C)
MEDIA_NEXT"MediaNextTrack" (as by W3C)
MEDIA_RECORD"MediaRecord" (as by W3C)
SEARCH"Search"
STOP"Escape"
MUSIC"Music"
GAMES"Games"
PLAY"PlayServices"
VOD"VOD"
DVR"DVR"
RADIO"Radio"
KEYBOARD"KeyboardExtend"
SCROLL_LOCK"Scroll"
SUBTITLES"Subtitles"
ZOOM"Zoom"
FAVOURITES"Favourites"
PLAY_LIST"PlayList"

STANDBY button key press (CTRL + "Esc") is handled by the platform and will never reach the portal, except for the modifier key "CTRL". To listen for standby events the portal needs to subscribe to the ToiInformationService::ON_OBJECTS_CHANGED event of the VAR_IO_STATE object. For more information on standby functionality, see Power Management.

Numeric keys

Numeric keys are generated from key presses on the remote control and keyboard as defined by W3C. The following JavaScript code can be used to create a mapping between these key codes and JavaScript variables:


var KEY_0 = "U+0030";
var KEY_1 = "U+0031";
var KEY_2 = "U+0032";
var KEY_3 = "U+0033";
var KEY_4 = "U+0034";
var KEY_5 = "U+0035";
var KEY_6 = "U+0036";
var KEY_7 = "U+0037";
var KEY_8 = "U+0038";
var KEY_9 = "U+0039";

Example: How to get an input event in the portal.

<sdk_root>/examples/example-html-portal/index.html

document.addEventListener("keydown", function(e) {
  console.log("Key pressed: " + e.keyIdentifier);
  e.preventDefault();

  switch (e.keyIdentifier) {
    case "Accept":
      console.log("You pressed OK!");
      break;
  }
}); 

Working with USB keyboards

It is possible to change the key mapping used by attached USB keyboards. See here for more info.

5.1.p5

Copyright (c) 2017 ARRIS Enterprises, LLC. All Rights Reserved. ARRIS Enterprises, LLC. Confidential Information.