Remote Control

When the user presses buttons on the remote control, these button presses will be sent over Bluetooth to the cloud connector, and then over the internet to the browser running in the cloud. From your app's point of view, these button presses will be received exactly as if the user had typed the equivalent keys on the keyboard.

Remote ButtonJavaScriptASCII Code
OKEnter13
BackEscape27
UpArrowUp38
DownArrowDown40
LeftArrowLeft37
RightArrowRight39

Key Listener

Every app should have a key down event listener like this:

document.addEventListener("keydown", async function(event) {
  switch (event.key) {
    case "Enter": ok(); break;
    case "Escape": back(); break;
    case "ArrowUp": up(); break;
    case "ArrowDown": down(); break;    
    case "ArrowLeft": left(); break;
    case "ArrowRight": right(); break;
    default: return;
  }
  event.preventDefault();
});

How you implement the up(), down(), left(), right(), ok() and back() functions is up to you and depends on your use case.

Note that it is not necessary to integrate with the Client Library to receive key events. It is exactly the same as how a standard web application would receive keyboard input in a normal browser. In fact, you can view your app in a desktop browser and test remote control input functionality by typing the equivalent keys.

If you are porting a Smart TV app, you may already have a key listener that is mostly compatible with Senza. Your app may associate the back button with a different code, so make sure to also listen for the Escape key.

Tutorials

For a more in-depth exploration of adapting an existing app for remote control based input, see the tutorials in the Remote Control section.


What’s Next