[Youtube Shorts] How to Register Remote Keys in a Tizen TV App
Handling remote control input is a core part of any Tizen TV app. To respond to keys like MediaPlayPause or the color buttons, you need to register them first — here’s how.
Add the Required Privilege
Before you can register remote keys, your app’s config.xml must declare the TV input device privilege. Without this, the key registration API won’t be accessible:
<tizen:privilege name=”http://tizen.org/privilege/tv.inputdevice”/>
Register Keys Using the tvinputdevice API
Tizen provides two approaches for registering remote control keys. To register a single key, call:
tizen.tvinputdevice.registerKey(‘MediaPlayPause’);
To register multiple keys at once and avoid repeated calls, use the batch method:
tizen.tvinputdevice.registerKeyBatch([‘MediaPlayPause’, ‘ColorF0Red’]);
The batch method is preferred when your app needs several non-default keys, as it’s more efficient and keeps your initialization code clean.
Listen for Key Events in Your App
Once a key is registered, you can listen for it using a standard keydown event listener on the document. Each key maps to a specific key code — for example, MediaPlayPause uses key code 10252:
document.addEventListener(‘keydown’, (e) => { if (e.keyCode === 10252) { // Handle Play/Pause } });
Watch the full video to see this registration process in action and learn how to wire up complete key handling in your Tizen TV application.