Skip to main content
Version: 6.4.2

IR Remote Control Input

For the specific logic of an application (games for example), binding the remote control inputs can be helpful. Only a subset of all remote control keys is supported on the specific device. Only numerical digits are guaranteed to be supported. This feature must be tested by users on real devices.

Event onKeyUp()

Parameters

ParametersTypeRequiredDescriptionSupported Since
event (in listener)Object
Yes
Plain JS object containing keyCode as number and keyName as string and type of event (always keyup string)1.3.0

Javascript syntax

await sos.input.onKeyUp((keyUpEvent) => {
console.log(`Pressed: ${keyUpEvent.keyCode} (${keyUpEvent.keyName})`);
});

Map of keyCodes:

NameKey codeNameKey Code
UNKNOWN0OK15
NUM_01YELLOW16
NUM_12BLUE17
NUM_23RED18
NUM_34GREEN19
NUM_45VOLUME_DOWN20
NUM_56VOLUME_UP30
NUM_67POWER31
NUM_78POWER_OFF32
NUM_89HOME33
NUM_910EXIT34
ARROW_LEFT11RETURN35
ARROW_UP12BACKSPACE36
ARROW_RIGHT13LOCK37
ARROW_DOWN14

Usage with Typescript

You can also use all these methods with signageOS TypeScript.

interface IKeyUpEvent {
type: 'keyup';
keyCode: number;
keyName: string;
}
interface IKeyUpEventListener {
(event: IKeyUpEvent): void;
}
onKeyUp(listener: IKeyUpEventListener): void;
GitHub Example