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

Input Handling

During its initialization of secondary applications, the portal subscribes to various keys. When the portal has input focus, and the secondaries are all stopped or hidden (the default startup condition), the portals event listener for the DOM keydown event (in index.html) receives all the input coming from the remote control.

When the portal shows a secondary application and sets the input focus to that secondary, only the secondary application receives the keypresses, unless the portal subscribes to certain key presses for that application.

<sdk_root>/examples/example-html-portal/multiapp.js

var props = getAppProperties(app);
// subscribe to exit key
if (props.exitKey) {
  app.subscribeKey(props.exitKey);
}
else {
  app.subscribeKey("BrowserBack");
}
// subscribe to menu key
if (props.menuKey) {
  app.subscribeKey(props.menuKey);
}
else {
  app.subscribeKey("Menu");
}

When the subscribed key is pressed, both the secondary application with input focus and the primary portal receive the key event. This allows the portal to listen for useful button presses. The portal will likely always subscribe to some kind of key used to switch back to the portal itself (the MENU, TV or BACK buttons on the remote being natural choices). The example portal also subscribes to a key used to show the portal main menu over the secondary.

You could define these behaviours to be identical for all secondary applications, but for a bit more flexibility the example portal reads the key used for exiting the app directly from the applications properties file.

Remapping the remote

Navigation for some web apps may not work in an intuitive way with the remote, or you might want to customize some feature for some reason. To be able to do this, a key mapping XML file can be specified inside the secondary app properties file with the KeyBindingMap property, which applies a custom mapping to the remote on a per-application basis.

The WebGLDemo application IIP contains a keymap.xml file, but for a more complete file showing which keycodes/keyIdentifiers can be mapped then take a look in the kreatv-app-webkit-browser IIP.

5.1.1.p8

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